Skip to content

[LV] Fix missing entry in willGenerateVectors #136712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4460,6 +4460,7 @@ static bool willGenerateVectors(VPlan &Plan, ElementCount VF,
case VPDef::VPWidenSelectSC:
case VPDef::VPBlendSC:
case VPDef::VPFirstOrderRecurrencePHISC:
case VPDef::VPHistogramSC:
case VPDef::VPWidenPHISC:
case VPDef::VPWidenIntOrFpInductionSC:
case VPDef::VPWidenPointerInductionSC:
Expand Down
23 changes: 23 additions & 0 deletions llvm/test/Transforms/LoopVectorize/AArch64/sve2-histcnt.ll
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,29 @@ for.exit:
ret void
}

; The histogram operation generates vectors. This example used to crash
; due to a missing entry in a switch statement.
define void @histogram_generates_vectors_crash(ptr %data_array) {
entry:
br label %for.body

for.body:
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
%gep.indices = getelementptr [1048576 x i32], ptr null, i64 %iv
%l.idx = load i32, ptr %gep.indices, align 4
%idxprom5 = sext i32 %l.idx to i64
%gep.bucket = getelementptr [1048576 x i32], ptr %data_array, i64 %idxprom5
%l.bucket = load i32, ptr %gep.bucket, align 4
%inc = add i32 %l.bucket, 0
store i32 %inc, ptr %gep.bucket, align 4
%iv.next = add i64 %iv, 1
%exitcond = icmp eq i64 %iv, 1
br i1 %exitcond, label %for.exit, label %for.body

for.exit:
ret void
}

attributes #0 = { "target-features"="+sve2" vscale_range(1,16) }

!0 = distinct !{!0, !1}
Expand Down
Loading