[llvm] [SLP]Remove operands upon marking instruction for deletion. (PR #97409)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 09:25:48 PDT 2024


================
@@ -17344,14 +17370,11 @@ class HorizontalReduction {
         Value *ReducedSubTree =
             emitReduction(VectorizedRoot, Builder, ReduxWidth, TTI);
         if (ReducedSubTree->getType() != VL.front()->getType()) {
-          ReducedSubTree = Builder.CreateIntCast(
-              ReducedSubTree, VL.front()->getType(), any_of(VL, [&](Value *R) {
-                KnownBits Known = computeKnownBits(
-                    R, cast<Instruction>(ReductionOps.front().front())
-                           ->getModule()
-                           ->getDataLayout());
-                return !Known.isNonNegative();
-              }));
+          assert(ReducedSubTree->getType() != VL.front()->getType() &&
+                 "Expected different reduction type.");
+          ReducedSubTree =
+              Builder.CreateIntCast(ReducedSubTree, VL.front()->getType(),
+                                    *V.isSignedMinBitwidthRootNode());
----------------
RKSimon wrote:

Why is it safe to directly dereference an optional?

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


More information about the llvm-commits mailing list