[llvm] [LV] Fix unsafe canVectorizeWithIfConvert() checks (PR #203273)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 07:19:05 PDT 2026


=?utf-8?q?Gaƫtan?= Bossu <gaetan.bossu at arm.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/203273 at github.com>


================
@@ -1470,14 +1481,13 @@ bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
             continue;
 
           auto *CurrI = dyn_cast<Instruction>(CurrV);
+          BasicBlock *LoopPred = TheLoop->getLoopPredecessor();
           if (!CurrI || !TheLoop->contains(CurrI)) {
             // If operands from outside the loop may be poison then Ptr may also
             // be poison.
-            if (!isGuaranteedNotToBePoison(CurrV, AC,
-                                           TheLoop->getLoopPredecessor()
-                                               ->getTerminator()
-                                               ->getIterator(),
-                                           DT))
+            if (!LoopPred ||
----------------
david-arm wrote:

Is this something that can only possibly happen when `allowExtraAnalysis` returns true? If so, is it worth adding assert similar to blockNeedsPredication when LoopPred is null?

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


More information about the llvm-commits mailing list