Skip to content

[SLP][REVEC] Fix false assumption of the source for castToScalarTyElem. #99424

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 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11850,8 +11850,7 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
Value *castToScalarTyElem(Value *V,
std::optional<bool> IsSigned = std::nullopt) {
auto *VecTy = cast<VectorType>(V->getType());
assert(getNumElements(ScalarTy) < getNumElements(VecTy) &&
(getNumElements(VecTy) % getNumElements(ScalarTy) == 0));
assert(getNumElements(VecTy) % getNumElements(ScalarTy) == 0);
if (VecTy->getElementType() == ScalarTy->getScalarType())
return V;
return Builder.CreateIntCast(
Expand Down
19 changes: 19 additions & 0 deletions llvm/test/Transforms/SLPVectorizer/revec-fix-99411.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -mtriple x86_64-unknown-linux-gnu -passes=slp-vectorizer -S %s | FileCheck %s

define void @e() {
; CHECK-LABEL: @e(
; CHECK-NEXT: entry:
; CHECK-NEXT: store <2 x i64> zeroinitializer, ptr null, align 8
; CHECK-NEXT: ret void
;
entry:
%0 = extractelement <1 x i64> zeroinitializer, i64 0
%bf.value = and i64 %0, 0
%bf.set = or i64 0, %bf.value
store i64 %bf.set, ptr getelementptr inbounds (i8, ptr null, i64 8), align 8
%bf.value2 = and i64 0, 0
%bf.set4 = or i64 0, %bf.value2
store i64 %bf.set4, ptr null, align 8
ret void
}
Loading