[llvm-branch-commits] [llvm] [SLP] Propagate lost IR flags to vectorized casts (PR #237240)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Oct 30 07:46:43 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-vectorizers

Author: Dmitry Sidorov (MrSidims)

<details>
<summary>Changes</summary>

Vectorized casts lost the fast-math flags, nneg and trunc nuw/nsw of the
scalar casts. Propagate them as for other nodes.

---

<sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>

---

Patch is 28.66 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/237240.diff


13 Files Affected:

- (modified) llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp (+19-4) 
- (modified) llvm/test/Transforms/SLPVectorizer/AArch64/or-reduction-byte-pack.ll (+11-11) 
- (modified) llvm/test/Transforms/SLPVectorizer/AMDGPU/fptrunc-f16-stores.ll (+1-1) 
- (modified) llvm/test/Transforms/SLPVectorizer/RISCV/unsigned-node-trunc-with-signed-users.ll (+1-1) 
- (modified) llvm/test/Transforms/SLPVectorizer/X86/logical-binops-booleanized-leaves.ll (+2-2) 
- (modified) llvm/test/Transforms/SLPVectorizer/X86/logical-reduction-booleanized-leaves.ll (+1-1) 
- (modified) llvm/test/Transforms/SLPVectorizer/X86/minbitwidth-drop-wrapping-flags.ll (+1-1) 
- (modified) llvm/test/Transforms/SLPVectorizer/X86/minbitwidth-icmp-to-trunc.ll (+1-1) 
- (modified) llvm/test/Transforms/SLPVectorizer/X86/non-power-of-2-bswap.ll (+1-1) 
- (modified) llvm/test/Transforms/SLPVectorizer/X86/propagate_ir_flags.ll (+8-8) 
- (modified) llvm/test/Transforms/SLPVectorizer/abs-overflow-incorrect-minbws.ll (+1-1) 
- (modified) llvm/test/Transforms/SLPVectorizer/revec-shufflevector.ll (+4-4) 
- (modified) llvm/test/Transforms/SLPVectorizer/revec.ll (+2-2) 


``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 2200273ec9deaa..6d8739d5703117 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -24232,11 +24232,19 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
     if (!I)
       return V;
     // Drop nneg propagated from the original cast.
-    Value *Op;
     if (auto *CI = dyn_cast<CastInst>(VL0);
-        CI && match(I, m_NNegZExt(m_Value(Op))) &&
-        Op->getType()->getScalarType() != CI->getSrcTy())
-      cast<ZExtInst>(I)->setNonNeg(false);
+        CI && isa<PossiblyNonNegInst>(I) &&
+        I->getOperand(0)->getType()->getScalarType() !=
+            CI->getSrcTy()->getScalarType())
+      I->setNonNeg(false);
+    // A copyable zext lane is a zext of a truncated constant, which may be
+    // negative or undef.
+    if (E->hasCopyableElements() && isa<PossiblyNonNegInst>(I) &&
+        any_of(enumerate(E->Scalars), [&](const auto &P) {
+          return E->isCopyableElement(P.value()) &&
+                 !match(E->getOperand(0)[P.index()], m_NonNegative());
+        }))
+      I->setNonNeg(false);
     // A lane may be emitted in negated form (sub C, x as add x, -C, or an
     // add/sub lane with swapped operands) when all its uses are
     // sign-insensitive (icmp eq/ne 0 or abs). The value stays correct for
@@ -24787,6 +24795,13 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
       Value *V = (VecOpcode != ShuffleOrOp && VecOpcode == Instruction::BitCast)
                      ? InVec
                      : Builder.CreateCast(VecOpcode, InVec, VecTy);
+      if (V != InVec) {
+        V = PropagateIRFlags(V);
+        // Wrap flags of the original trunc do not hold for a demoted result.
+        if (It != MinBWs.end())
+          if (auto *TI = dyn_cast<TruncInst>(V))
+            TI->dropPoisonGeneratingFlags();
+      }
       V = FinalShuffle(V, E);
 
       E->VectorizedValue = V;
diff --git a/llvm/test/Transforms/SLPVectorizer/AArch64/or-reduction-byte-pack.ll b/llvm/test/Transforms/SLPVectorizer/AArch64/or-reduction-byte-pack.ll
index a2a5105903c853..5caf3ed98a55af 100644
--- a/llvm/test/Transforms/SLPVectorizer/AArch64/or-reduction-byte-pack.ll
+++ b/llvm/test/Transforms/SLPVectorizer/AArch64/or-reduction-byte-pack.ll
@@ -38,7 +38,7 @@ define i64 @pack_bytes(ptr %p) {
 ; BE-NEXT:    [[TMP3:%.*]] = load <6 x i16>, ptr [[ARRAYIDX_2]], align 2
 ; BE-NEXT:    [[TMP4:%.*]] = lshr <6 x i16> [[TMP3]], splat (i16 4)
 ; BE-NEXT:    [[TMP5:%.*]] = and <6 x i16> [[TMP4]], splat (i16 255)
-; BE-NEXT:    [[TMP6:%.*]] = zext <6 x i16> [[TMP5]] to <6 x i64>
+; BE-NEXT:    [[TMP6:%.*]] = zext nneg <6 x i16> [[TMP5]] to <6 x i64>
 ; BE-NEXT:    [[TMP7:%.*]] = shl nuw <6 x i64> [[TMP6]], <i64 16, i64 24, i64 32, i64 40, i64 48, i64 56>
 ; BE-NEXT:    [[TMP8:%.*]] = shl i16 [[TMP2]], 4
 ; BE-NEXT:    [[TMP9:%.*]] = and i16 [[TMP1]], 255
@@ -118,7 +118,7 @@ define i64 @nonuniform_shift(ptr %p) {
 ; CHECK-NEXT:    [[TMP3:%.*]] = load <6 x i16>, ptr [[ARRAYIDX_2]], align 2
 ; CHECK-NEXT:    [[TMP4:%.*]] = lshr <6 x i16> [[TMP3]], <i16 6, i16 4, i16 4, i16 4, i16 4, i16 4>
 ; CHECK-NEXT:    [[TMP5:%.*]] = and <6 x i16> [[TMP4]], splat (i16 255)
-; CHECK-NEXT:    [[TMP6:%.*]] = zext <6 x i16> [[TMP5]] to <6 x i64>
+; CHECK-NEXT:    [[TMP6:%.*]] = zext nneg <6 x i16> [[TMP5]] to <6 x i64>
 ; CHECK-NEXT:    [[TMP7:%.*]] = bitcast <6 x i64> [[TMP6]] to <48 x i8>
 ; CHECK-NEXT:    [[TMP8:%.*]] = shufflevector <48 x i8> [[TMP7]], <48 x i8> zeroinitializer, <8 x i32> <i32 48, i32 48, i32 0, i32 8, i32 16, i32 24, i32 32, i32 40>
 ; CHECK-NEXT:    [[TMP9:%.*]] = bitcast <8 x i8> [[TMP8]] to i64
@@ -142,7 +142,7 @@ define i64 @nonuniform_shift(ptr %p) {
 ; BE-NEXT:    [[TMP3:%.*]] = load <6 x i16>, ptr [[ARRAYIDX_2]], align 2
 ; BE-NEXT:    [[TMP4:%.*]] = lshr <6 x i16> [[TMP3]], <i16 6, i16 4, i16 4, i16 4, i16 4, i16 4>
 ; BE-NEXT:    [[TMP5:%.*]] = and <6 x i16> [[TMP4]], splat (i16 255)
-; BE-NEXT:    [[TMP6:%.*]] = zext <6 x i16> [[TMP5]] to <6 x i64>
+; BE-NEXT:    [[TMP6:%.*]] = zext nneg <6 x i16> [[TMP5]] to <6 x i64>
 ; BE-NEXT:    [[TMP7:%.*]] = shl nuw <6 x i64> [[TMP6]], <i64 16, i64 24, i64 32, i64 40, i64 48, i64 56>
 ; BE-NEXT:    [[TMP8:%.*]] = shl i16 [[TMP2]], 4
 ; BE-NEXT:    [[TMP9:%.*]] = and i16 [[TMP1]], 255
@@ -222,7 +222,7 @@ define i64 @masked_field(ptr %p) {
 ; CHECK-NEXT:    [[TMP3:%.*]] = load <6 x i16>, ptr [[ARRAYIDX_2]], align 2
 ; CHECK-NEXT:    [[TMP4:%.*]] = lshr <6 x i16> [[TMP3]], splat (i16 4)
 ; CHECK-NEXT:    [[TMP5:%.*]] = and <6 x i16> [[TMP4]], <i16 254, i16 255, i16 255, i16 255, i16 255, i16 255>
-; CHECK-NEXT:    [[TMP6:%.*]] = zext <6 x i16> [[TMP5]] to <6 x i64>
+; CHECK-NEXT:    [[TMP6:%.*]] = zext nneg <6 x i16> [[TMP5]] to <6 x i64>
 ; CHECK-NEXT:    [[TMP7:%.*]] = shl nuw <6 x i64> [[TMP6]], <i64 16, i64 24, i64 32, i64 40, i64 48, i64 56>
 ; CHECK-NEXT:    [[TMP8:%.*]] = shl i16 [[TMP2]], 4
 ; CHECK-NEXT:    [[TMP9:%.*]] = and i16 [[TMP1]], 255
@@ -245,7 +245,7 @@ define i64 @masked_field(ptr %p) {
 ; BE-NEXT:    [[TMP3:%.*]] = load <6 x i16>, ptr [[ARRAYIDX_2]], align 2
 ; BE-NEXT:    [[TMP4:%.*]] = lshr <6 x i16> [[TMP3]], splat (i16 4)
 ; BE-NEXT:    [[TMP5:%.*]] = and <6 x i16> [[TMP4]], <i16 254, i16 255, i16 255, i16 255, i16 255, i16 255>
-; BE-NEXT:    [[TMP6:%.*]] = zext <6 x i16> [[TMP5]] to <6 x i64>
+; BE-NEXT:    [[TMP6:%.*]] = zext nneg <6 x i16> [[TMP5]] to <6 x i64>
 ; BE-NEXT:    [[TMP7:%.*]] = shl nuw <6 x i64> [[TMP6]], <i64 16, i64 24, i64 32, i64 40, i64 48, i64 56>
 ; BE-NEXT:    [[TMP8:%.*]] = shl i16 [[TMP2]], 4
 ; BE-NEXT:    [[TMP9:%.*]] = and i16 [[TMP1]], 255
@@ -469,7 +469,7 @@ define i64 @pack_rev(ptr %p) {
 ; BE-NEXT:    [[TMP3:%.*]] = load <6 x i16>, ptr [[P]], align 2
 ; BE-NEXT:    [[TMP4:%.*]] = lshr <6 x i16> [[TMP3]], splat (i16 4)
 ; BE-NEXT:    [[TMP5:%.*]] = and <6 x i16> [[TMP4]], splat (i16 255)
-; BE-NEXT:    [[TMP6:%.*]] = zext <6 x i16> [[TMP5]] to <6 x i64>
+; BE-NEXT:    [[TMP6:%.*]] = zext nneg <6 x i16> [[TMP5]] to <6 x i64>
 ; BE-NEXT:    [[TMP7:%.*]] = shl nuw <6 x i64> [[TMP6]], <i64 56, i64 48, i64 40, i64 32, i64 24, i64 16>
 ; BE-NEXT:    [[TMP8:%.*]] = shl i16 [[TMP2]], 4
 ; BE-NEXT:    [[TMP9:%.*]] = and i16 [[TMP1]], 255
@@ -558,7 +558,7 @@ define i64 @pack_shift3(ptr %p) {
 ; BE-NEXT:    [[TMP3:%.*]] = load <6 x i16>, ptr [[ARRAYIDX_2]], align 2
 ; BE-NEXT:    [[TMP4:%.*]] = lshr <6 x i16> [[TMP3]], splat (i16 3)
 ; BE-NEXT:    [[TMP5:%.*]] = and <6 x i16> [[TMP4]], splat (i16 255)
-; BE-NEXT:    [[TMP6:%.*]] = zext <6 x i16> [[TMP5]] to <6 x i64>
+; BE-NEXT:    [[TMP6:%.*]] = zext nneg <6 x i16> [[TMP5]] to <6 x i64>
 ; BE-NEXT:    [[TMP7:%.*]] = shl nuw <6 x i64> [[TMP6]], <i64 16, i64 24, i64 32, i64 40, i64 48, i64 56>
 ; BE-NEXT:    [[TMP8:%.*]] = shl i16 [[TMP2]], 5
 ; BE-NEXT:    [[TMP9:%.*]] = and i16 [[TMP1]], 255
@@ -689,7 +689,7 @@ define i64 @pack_rev_i16_fields(ptr %p) {
 ; BE-NEXT:    [[TMP0:%.*]] = load <4 x i32>, ptr [[P]], align 4
 ; BE-NEXT:    [[TMP1:%.*]] = lshr <4 x i32> [[TMP0]], splat (i32 4)
 ; BE-NEXT:    [[TMP2:%.*]] = and <4 x i32> [[TMP1]], splat (i32 65535)
-; BE-NEXT:    [[TMP3:%.*]] = zext <4 x i32> [[TMP2]] to <4 x i64>
+; BE-NEXT:    [[TMP3:%.*]] = zext nneg <4 x i32> [[TMP2]] to <4 x i64>
 ; BE-NEXT:    [[TMP4:%.*]] = shl nuw <4 x i64> [[TMP3]], <i64 48, i64 32, i64 16, i64 0>
 ; BE-NEXT:    [[TMP5:%.*]] = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> [[TMP4]])
 ; BE-NEXT:    ret i64 [[TMP5]]
@@ -743,7 +743,7 @@ define i64 @pack_add(ptr %p, ptr %q) {
 ; BE-NEXT:    [[TMP2:%.*]] = add <8 x i16> [[TMP0]], [[TMP1]]
 ; BE-NEXT:    [[TMP3:%.*]] = lshr <8 x i16> [[TMP2]], splat (i16 4)
 ; BE-NEXT:    [[TMP4:%.*]] = and <8 x i16> [[TMP3]], splat (i16 255)
-; BE-NEXT:    [[TMP5:%.*]] = zext <8 x i16> [[TMP4]] to <8 x i64>
+; BE-NEXT:    [[TMP5:%.*]] = zext nneg <8 x i16> [[TMP4]] to <8 x i64>
 ; BE-NEXT:    [[TMP6:%.*]] = shl nuw <8 x i64> [[TMP5]], <i64 0, i64 8, i64 16, i64 24, i64 32, i64 40, i64 48, i64 56>
 ; BE-NEXT:    [[TMP7:%.*]] = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> [[TMP6]])
 ; BE-NEXT:    ret i64 [[TMP7]]
@@ -852,7 +852,7 @@ define i64 @pack_alt_src(ptr %p, ptr %q) {
 ; BE-NEXT:    [[TMP4:%.*]] = shufflevector <4 x i16> [[TMP2]], <4 x i16> [[TMP3]], <4 x i32> <i32 0, i32 5, i32 2, i32 7>
 ; BE-NEXT:    [[TMP5:%.*]] = lshr <4 x i16> [[TMP4]], splat (i16 4)
 ; BE-NEXT:    [[TMP6:%.*]] = and <4 x i16> [[TMP5]], splat (i16 255)
-; BE-NEXT:    [[TMP7:%.*]] = zext <4 x i16> [[TMP6]] to <4 x i64>
+; BE-NEXT:    [[TMP7:%.*]] = zext nneg <4 x i16> [[TMP6]] to <4 x i64>
 ; BE-NEXT:    [[TMP8:%.*]] = shl nuw <4 x i64> [[TMP7]], <i64 0, i64 8, i64 16, i64 24>
 ; BE-NEXT:    [[PA4:%.*]] = getelementptr inbounds nuw i16, ptr [[P]], i64 4
 ; BE-NEXT:    [[PB4:%.*]] = getelementptr inbounds nuw i16, ptr [[Q]], i64 4
@@ -863,7 +863,7 @@ define i64 @pack_alt_src(ptr %p, ptr %q) {
 ; BE-NEXT:    [[TMP13:%.*]] = shufflevector <4 x i16> [[TMP11]], <4 x i16> [[TMP12]], <4 x i32> <i32 0, i32 5, i32 2, i32 7>
 ; BE-NEXT:    [[TMP14:%.*]] = lshr <4 x i16> [[TMP13]], splat (i16 4)
 ; BE-NEXT:    [[TMP15:%.*]] = and <4 x i16> [[TMP14]], splat (i16 255)
-; BE-NEXT:    [[TMP16:%.*]] = zext <4 x i16> [[TMP15]] to <4 x i64>
+; BE-NEXT:    [[TMP16:%.*]] = zext nneg <4 x i16> [[TMP15]] to <4 x i64>
 ; BE-NEXT:    [[TMP17:%.*]] = shl nuw <4 x i64> [[TMP16]], <i64 32, i64 40, i64 48, i64 56>
 ; BE-NEXT:    [[RDX_OP:%.*]] = or disjoint <4 x i64> [[TMP8]], [[TMP17]]
 ; BE-NEXT:    [[TMP18:%.*]] = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> [[RDX_OP]])
diff --git a/llvm/test/Transforms/SLPVectorizer/AMDGPU/fptrunc-f16-stores.ll b/llvm/test/Transforms/SLPVectorizer/AMDGPU/fptrunc-f16-stores.ll
index 8cc663ba05d1e8..7e86b5eab7a3b8 100644
--- a/llvm/test/Transforms/SLPVectorizer/AMDGPU/fptrunc-f16-stores.ll
+++ b/llvm/test/Transforms/SLPVectorizer/AMDGPU/fptrunc-f16-stores.ll
@@ -69,7 +69,7 @@ define void @unpack_fma_fptrunc_stores(ptr addrspace(1) %in, ptr addrspace(1) %o
 ; GCN-NEXT:    [[TMP2:%.*]] = uitofp <4 x i16> [[TMP1]] to <4 x float>
 ; GCN-NEXT:    [[TMP3:%.*]] = fmul nnan contract <4 x float> [[TMP2]], splat (float f0x37800000)
 ; GCN-NEXT:    [[TMP4:%.*]] = fadd contract <4 x float> [[TMP3]], splat (float f0x37800000)
-; GCN-NEXT:    [[TMP5:%.*]] = fptrunc <4 x float> [[TMP4]] to <4 x half>
+; GCN-NEXT:    [[TMP5:%.*]] = fptrunc contract <4 x float> [[TMP4]] to <4 x half>
 ; GCN-NEXT:    store <4 x half> [[TMP5]], ptr addrspace(1) [[OUT]], align 8
 ; GCN-NEXT:    ret void
 ;
diff --git a/llvm/test/Transforms/SLPVectorizer/RISCV/unsigned-node-trunc-with-signed-users.ll b/llvm/test/Transforms/SLPVectorizer/RISCV/unsigned-node-trunc-with-signed-users.ll
index 84b68956e9bfd9..265413e01c9ddc 100644
--- a/llvm/test/Transforms/SLPVectorizer/RISCV/unsigned-node-trunc-with-signed-users.ll
+++ b/llvm/test/Transforms/SLPVectorizer/RISCV/unsigned-node-trunc-with-signed-users.ll
@@ -18,7 +18,7 @@ define void @test(ptr %p, i16 %load794) {
 ; CHECK-NEXT:    [[TMP9:%.*]] = zext <2 x i32> [[TMP12]] to <2 x i64>
 ; CHECK-NEXT:    [[TMP22:%.*]] = mul nuw nsw <2 x i64> [[TMP9]], splat (i64 5039)
 ; CHECK-NEXT:    [[TMP11:%.*]] = lshr <2 x i64> [[TMP22]], splat (i64 24)
-; CHECK-NEXT:    [[TMP13:%.*]] = trunc <2 x i64> [[TMP11]] to <2 x i32>
+; CHECK-NEXT:    [[TMP13:%.*]] = trunc nuw nsw <2 x i64> [[TMP11]] to <2 x i32>
 ; CHECK-NEXT:    [[TMP20:%.*]] = mul <2 x i32> [[TMP13]], splat (i32 62207)
 ; CHECK-NEXT:    [[TMP21:%.*]] = add <2 x i32> [[TMP20]], [[TMP12]]
 ; CHECK-NEXT:    [[TMP14:%.*]] = trunc <2 x i32> [[TMP21]] to <2 x i16>
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/logical-binops-booleanized-leaves.ll b/llvm/test/Transforms/SLPVectorizer/X86/logical-binops-booleanized-leaves.ll
index af56b05764a61e..7e06ed98b02471 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/logical-binops-booleanized-leaves.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/logical-binops-booleanized-leaves.ll
@@ -386,9 +386,9 @@ define <8 x i1> @and_multiuse_bv(ptr %p, ptr %q, ptr %s) {
 ; CHECK-NEXT:    [[TMP0:%.*]] = load <8 x i8>, ptr [[P]], align 1
 ; CHECK-NEXT:    [[A0:%.*]] = load i8, ptr [[P]], align 1, !range [[RNG0:![0-9]+]], !noundef [[META1:![0-9]+]]
 ; CHECK-NEXT:    [[TMP1:%.*]] = load <8 x i8>, ptr [[Q]], align 1
-; CHECK-NEXT:    [[TMP2:%.*]] = trunc <8 x i8> [[TMP0]] to <8 x i1>
+; CHECK-NEXT:    [[TMP2:%.*]] = trunc nuw <8 x i8> [[TMP0]] to <8 x i1>
 ; CHECK-NEXT:    [[T0:%.*]] = trunc nuw i8 [[A0]] to i1
-; CHECK-NEXT:    [[TMP3:%.*]] = trunc <8 x i8> [[TMP1]] to <8 x i1>
+; CHECK-NEXT:    [[TMP3:%.*]] = trunc nuw <8 x i8> [[TMP1]] to <8 x i1>
 ; CHECK-NEXT:    store i1 [[T0]], ptr [[S]], align 1
 ; CHECK-NEXT:    [[TMP4:%.*]] = and <8 x i1> [[TMP2]], [[TMP3]]
 ; CHECK-NEXT:    ret <8 x i1> [[TMP4]]
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/logical-reduction-booleanized-leaves.ll b/llvm/test/Transforms/SLPVectorizer/X86/logical-reduction-booleanized-leaves.ll
index 3628dcd9ff675b..8ecaaeb9627fac 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/logical-reduction-booleanized-leaves.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/logical-reduction-booleanized-leaves.ll
@@ -206,7 +206,7 @@ define i1 @and_16_poisonable(ptr %input) {
 ; CHECK-NEXT:    [[T7:%.*]] = trunc nuw i8 [[TMP1]] to i1
 ; CHECK-NEXT:    [[P8:%.*]] = getelementptr inbounds nuw i8, ptr [[INPUT]], i64 8
 ; CHECK-NEXT:    [[TMP2:%.*]] = load <8 x i8>, ptr [[P8]], align 1
-; CHECK-NEXT:    [[TMP3:%.*]] = trunc <8 x i8> [[TMP2]] to <8 x i1>
+; CHECK-NEXT:    [[TMP3:%.*]] = trunc nuw <8 x i8> [[TMP2]] to <8 x i1>
 ; CHECK-NEXT:    [[TMP4:%.*]] = freeze <8 x i1> [[TMP3]]
 ; CHECK-NEXT:    [[TMP5:%.*]] = call i1 @llvm.vector.reduce.and.v8i1(<8 x i1> [[TMP4]])
 ; CHECK-NEXT:    [[OP_RDX:%.*]] = select i1 [[TMP5]], i1 [[T7]], i1 false
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/minbitwidth-drop-wrapping-flags.ll b/llvm/test/Transforms/SLPVectorizer/X86/minbitwidth-drop-wrapping-flags.ll
index 2f75aec04290a6..f0cc9706c4eeca 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/minbitwidth-drop-wrapping-flags.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/minbitwidth-drop-wrapping-flags.ll
@@ -167,7 +167,7 @@ define void @trunc_nuw_nsw_on_narrowed_source(ptr %p, ptr %r, ptr %q, ptr %e) {
 ; CHECK-NEXT:    [[TMP3:%.*]] = zext <4 x i16> [[TMP1]] to <4 x i32>
 ; CHECK-NEXT:    [[TMP4:%.*]] = zext <4 x i16> [[TMP2]] to <4 x i32>
 ; CHECK-NEXT:    [[TMP5:%.*]] = add <4 x i32> [[TMP3]], [[TMP4]]
-; CHECK-NEXT:    [[TMP6:%.*]] = trunc <4 x i32> [[TMP5]] to <4 x i16>
+; CHECK-NEXT:    [[TMP6:%.*]] = trunc nuw nsw <4 x i32> [[TMP5]] to <4 x i16>
 ; CHECK-NEXT:    store <4 x i16> [[TMP6]], ptr [[Q]], align 2
 ; CHECK-NEXT:    [[TMP7:%.*]] = extractelement <4 x i32> [[TMP5]], i64 2
 ; CHECK-NEXT:    [[TMP8:%.*]] = zext i32 [[TMP7]] to i64
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/minbitwidth-icmp-to-trunc.ll b/llvm/test/Transforms/SLPVectorizer/X86/minbitwidth-icmp-to-trunc.ll
index 56d0c75cd171b2..212ab47d6e6ede 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/minbitwidth-icmp-to-trunc.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/minbitwidth-icmp-to-trunc.ll
@@ -18,7 +18,7 @@ define i1 @test(ptr noalias %0, i64 %1, ptr noalias %p, ptr %p1) {
 ; CHECK-NEXT:    [[TMP8:%.*]] = and <2 x i24> [[TMP7]], splat (i24 255)
 ; CHECK-NEXT:    [[TMP9:%.*]] = icmp eq <2 x i24> [[TMP8]], splat (i24 24)
 ; CHECK-NEXT:    [[TMP10:%.*]] = select <2 x i1> [[TMP9]], <2 x i24> splat (i24 23), <2 x i24> [[TMP8]]
-; CHECK-NEXT:    [[TMP26:%.*]] = zext <2 x i24> [[TMP10]] to <2 x i32>
+; CHECK-NEXT:    [[TMP26:%.*]] = zext nneg <2 x i24> [[TMP10]] to <2 x i32>
 ; CHECK-NEXT:    [[TMP13:%.*]] = and <2 x i32> [[TMP26]], splat (i32 254)
 ; CHECK-NEXT:    [[TMP15:%.*]] = icmp eq <2 x i32> [[TMP13]], splat (i32 4)
 ; CHECK-NEXT:    [[TMP14:%.*]] = select <2 x i1> [[TMP15]], <2 x i32> splat (i32 2), <2 x i32> [[TMP26]]
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/non-power-of-2-bswap.ll b/llvm/test/Transforms/SLPVectorizer/X86/non-power-of-2-bswap.ll
index 6bd2c60f6be51d..f8ebccecc58498 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/non-power-of-2-bswap.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/non-power-of-2-bswap.ll
@@ -7,7 +7,7 @@ define i32 @test(i8 %0) {
 ; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <3 x i8> poison, i8 [[TMP0]], i64 0
 ; CHECK-NEXT:    [[TMP3:%.*]] = shufflevector <3 x i8> [[TMP2]], <3 x i8> poison, <3 x i32> zeroinitializer
 ; CHECK-NEXT:    [[TMP4:%.*]] = and <3 x i8> [[TMP3]], splat (i8 1)
-; CHECK-NEXT:    [[TMP5:%.*]] = zext <3 x i8> [[TMP4]] to <3 x i32>
+; CHECK-NEXT:    [[TMP5:%.*]] = zext nneg <3 x i8> [[TMP4]] to <3 x i32>
 ; CHECK-NEXT:    [[TMP6:%.*]] = shl nuw nsw <3 x i32> [[TMP5]], <i32 0, i32 8, i32 16>
 ; CHECK-NEXT:    [[TMP7:%.*]] = call i32 @llvm.vector.reduce.or.v3i32(<3 x i32> [[TMP6]])
 ; CHECK-NEXT:    ret i32 [[TMP7]]
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/propagate_ir_flags.ll b/llvm/test/Transforms/SLPVectorizer/X86/propagate_ir_flags.ll
index e00fb869dc86c1..9252e9187ca228 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/propagate_ir_flags.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/propagate_ir_flags.ll
@@ -647,7 +647,7 @@ define void @select_not_all_nnan(ptr %d, <4 x i1> %m, <4 x float> %x, <4 x float
 define void @fptrunc_fast(ptr %x, ptr %y) {
 ; CHECK-LABEL: @fptrunc_fast(
 ; CHECK-NEXT:    [[TMP1:%.*]] = load <4 x double>, ptr [[X:%.*]], align 8
-; CHECK-NEXT:    [[TMP2:%.*]] = fptrunc <4 x double> [[TMP1]] to <4 x float>
+; CHECK-NEXT:    [[TMP2:%.*]] = fptrunc fast <4 x double> [[TMP1]] to <4 x float>
 ; CHECK-NEXT:    store <4 x float> [[TMP2]], ptr [[Y:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -681,9 +681,9 @@ define void @fpext_only_nnan(ptr %x, ptr %y) {
 ; CHECK-NEXT:    [[IDX3:%.*]] = getelementptr inbounds float, ptr [[X:%.*]], i64 2
 ; CHECK-NEXT:    [[OUT3:%.*]] = getelementptr inbounds double, ptr [[Y:%.*]], i64 2
 ; CHECK-NEXT:    [[TMP1:%.*]] = load <2 x float>, ptr [[X]], align 4
-; CHECK-NEXT:    [[TMP2:%.*]] = fpext <2 x float> [[TMP1]] to <2 x double>
+; CHECK-NEXT:    [[TMP2:%.*]] = fpext nnan <2 x float> [[TMP1]] to <2 x double>
 ; CHECK-NEXT:    [[TMP3:%.*]] = load <2 x float>, ptr [[IDX3]], align 4
-; CHECK-NEXT:    [[TMP4:%.*]] = fpext <2 x float> [[TMP3]] to <2 x double>
+; CHECK-NEXT:    [[TMP4:%.*]] = fpext nnan <2 x float> [[TMP3]] to <2 x double>
 ; CHECK-NEXT:    store <2 x double> [[TMP2]], ptr [[Y]], align 8
 ; CHECK-NEXT:    store <2 x double> [[TMP4]], ptr [[OUT3]], align 8
 ; CHECK-NEXT:    ret void
@@ -716,7 +716,7 @@ define void @fpext_only_nnan(ptr %x, ptr %y) {
 define void @sitofp_fast(ptr %x, ptr %y) {
 ; CHECK-LABEL: @sitofp_fast(
 ; CHECK-NEXT:    [[TMP1:%.*]] = load <4 x i32>, ptr [[X:%.*]], align 4
-; CHECK-NEXT:    [[TMP2:%.*]] = sitofp <4 x i32> [[TMP1]] to <4 x float>
+; CHECK-NEXT:    [[TMP2:%.*]] = sitofp fast <4 x i32> [[TMP1]] to <4 x float>
 ; CHECK-NEXT:    store <4 x float> [[TMP2]], ptr [[Y:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -748,7 +748,7 @@ define void @sitofp_fast(ptr %x, ptr %y) {
 define void @uitofp_nneg(ptr %x, ptr %y) {
 ; CHECK-LABEL: @uitofp_nneg(
 ; CHECK-NEXT:    [[TMP1:%.*]] = load <4 x i32>, ptr [[X:%.*]], align 4
-; CHECK-NEXT:    [[TMP2:%.*]] = uitofp <4 x i32> [[TMP1]] to <4 x float>
+; CHECK-NEXT:    [[TMP2:%.*]] = uitofp nneg <4 x i32> [[TMP1]] to <4 x float>
 ; CHECK-NEXT:    store <4 x float> [[TMP2]], ptr [[Y:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -780,7 +780,7 @@ define void @uitofp_nneg(ptr %x, ptr %y) {
 define void @zext_nneg(ptr %x, ptr %y) {
 ; CHECK-LABEL: @zext_nneg(
 ; CHECK-NEXT:    [[TMP1:%.*]] = load <4 x i16>, ptr [[X:%.*]], align 2
-; CHECK-NEXT:    [[TMP2:%.*]] = zext <4 x i16> [[TMP1]] to <4 x i32>
+; CHECK-NEXT:    [[TMP2:%.*]] = zext nneg <4 x i16> [[TMP1]] to <4 x i32>
 ; CHECK-NEXT:    store <4 x i32> [[TMP2]], ptr [[Y:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -814,7 +814,7 @@ define void @zext_nneg_copyable_const(ptr %y, i8 %a, i8 %b, i8 %c, i32 %x) #1 {
 ; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <4 x i8> <i8 poison, i8 poison, i8 poison, i8 100>, i8 [[A:%.*]], i64 0
 ; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <4 x i8> [[TMP1]], i8 [[B:%.*]], i64 1
 ; CHECK-NEXT:    [[TMP3:%.*]] = insertelement <4 x i8> [[TMP2]], i8 [[C:%.*]], i64 2
-; CHECK-NEXT:    [[TMP4:%.*]] = zext <4 x i8> [[TMP3]] to <4 x i32>
+...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/237240


More information about the llvm-branch-commits mailing list