[llvm] 954befe - [LV] Turn check into assert in fixFixedOrderRecurrence (NFCI).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 13:11:59 PDT 2023


Author: Florian Hahn
Date: 2023-04-10T21:11:41+01:00
New Revision: 954befe2a7450d153bc001979eb2376e40b5c491

URL: https://github.com/llvm/llvm-project/commit/954befe2a7450d153bc001979eb2376e40b5c491
DIFF: https://github.com/llvm/llvm-project/commit/954befe2a7450d153bc001979eb2376e40b5c491.diff

LOG: [LV] Turn check into assert in fixFixedOrderRecurrence (NFCI).

Suggested as independent cleanup in D147567. Either VF or UF need to be
> 1. Note that if the condition would be false, the code below would use
a nullptr and crash.

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 4643cc75ea06..ccbafccd9fb1 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3892,12 +3892,14 @@ void InnerLoopVectorizer::fixFixedOrderRecurrence(
       auto *Idx = Builder.CreateSub(RuntimeVF, ConstantInt::get(IdxTy, 2));
       ExtractForPhiUsedOutsideLoop = Builder.CreateExtractElement(
           Incoming, Idx, "vector.recur.extract.for.phi");
-    } else if (UF > 1)
+    } else {
+      assert(UF > 1 && "VF and UF cannot both be 1");
       // When loop is unrolled without vectorizing, initialize
       // ExtractForPhiUsedOutsideLoop with the value just prior to unrolled
       // value of `Incoming`. This is analogous to the vectorized case above:
       // extracting the second last element when VF > 1.
       ExtractForPhiUsedOutsideLoop = State.get(PreviousDef, UF - 2);
+    }
 
     for (VPLiveOut *LiveOut : LiveOuts) {
       assert(!Cost->requiresScalarEpilogue(VF));


        


More information about the llvm-commits mailing list