[llvm] 73950f2 - [LV] Replace check with assert for reduction resume values (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 8 08:26:36 PDT 2022


Author: Florian Hahn
Date: 2022-10-08T16:26:10+01:00
New Revision: 73950f26f5ac2d65f7890c71a44caa541b629648

URL: https://github.com/llvm/llvm-project/commit/73950f26f5ac2d65f7890c71a44caa541b629648
DIFF: https://github.com/llvm/llvm-project/commit/73950f26f5ac2d65f7890c71a44caa541b629648.diff

LOG: [LV] Replace check with assert for reduction resume values (NFC).

At this point, we need to have resume values for all inductions. If not,
this would result in silent mis-compiles.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 7145a93b3956a..ce1e771678a0e 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -10498,11 +10498,11 @@ bool LoopVectorizePass::processLoop(Loop *L) {
         // updated before vectorising the epilogue loop.
         for (VPRecipeBase &R : Header->phis()) {
           if (auto *ReductionPhi = dyn_cast<VPReductionPHIRecipe>(&R)) {
-            if (auto *Resume = MainILV.getReductionResumeValue(
-                    ReductionPhi->getRecurrenceDescriptor())) {
-              VPValue *StartVal = BestEpiPlan.getOrAddExternalDef(Resume);
-              ReductionPhi->setOperand(0, StartVal);
-            }
+            Value *Resume = MainILV.getReductionResumeValue(
+                ReductionPhi->getRecurrenceDescriptor());
+            assert(Resume && "Must have a resume value.");
+            VPValue *StartVal = BestEpiPlan.getOrAddExternalDef(Resume);
+            ReductionPhi->setOperand(0, StartVal);
           }
         }
 


        


More information about the llvm-commits mailing list