Skip to content

Commit f00f294

Browse files
committed
[SLP]Fix PR91309: Do not consider SExt as always producing signed result.
Still need to do the full analysis of the signedness of the values rather than rely on Instruction opcode, if the opcode is SExt. Still may produce unsigned result.
1 parent b247776 commit f00f294

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15487,8 +15487,7 @@ void BoUpSLP::computeMinimumValueSizes() {
1548715487
TreeEntry *TE = VectorizableTree[Idx].get();
1548815488
if (MinBWs.contains(TE))
1548915489
continue;
15490-
bool IsSigned = TE->getOpcode() == Instruction::SExt ||
15491-
any_of(TE->Scalars, [&](Value *R) {
15490+
bool IsSigned = any_of(TE->Scalars, [&](Value *R) {
1549215491
return !isKnownNonNegative(R, SimplifyQuery(*DL));
1549315492
});
1549415493
MinBWs.try_emplace(TE, MaxBitWidth, IsSigned);

llvm/test/Transforms/SLPVectorizer/AArch64/unsigned-after-sext-node.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
define i16 @test() {
55
; CHECK-LABEL: define i16 @test() {
66
; CHECK-NEXT: entry:
7-
; CHECK-NEXT: [[LNOT:%.*]] = xor i1 false, true
7+
; CHECK-NEXT: [[LNOT:%.*]] = xor i1 true, true
88
; CHECK-NEXT: [[LNOT_EXT:%.*]] = zext i1 [[LNOT]] to i16
99
; CHECK-NEXT: [[ADD:%.*]] = add nsw i16 0, [[LNOT_EXT]]
10-
; CHECK-NEXT: [[LNOT5:%.*]] = xor i1 false, true
10+
; CHECK-NEXT: [[LNOT5:%.*]] = xor i1 true, true
1111
; CHECK-NEXT: [[LNOT_EXT6:%.*]] = zext i1 [[LNOT5]] to i16
1212
; CHECK-NEXT: [[ADD7:%.*]] = add nsw i16 [[ADD]], [[LNOT_EXT6]]
1313
; CHECK-NEXT: ret i16 [[ADD7]]

0 commit comments

Comments
 (0)