[llvm] [LoopVectorize] Enable vectorisation of early exit loops with live-outs (PR #120567)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 07:29:56 PST 2025


================
@@ -2775,6 +2775,23 @@ BasicBlock *InnerLoopVectorizer::createVectorizedLoopSkeleton(
   return LoopVectorPreHeader;
 }
 
+static bool isValueIncomingFromBlock(BasicBlock *ExitingBB, Value *V,
+                                     Instruction *UI) {
+  PHINode *PHI = dyn_cast<PHINode>(UI);
----------------
huntergr-arm wrote:

```suggestion
  PHINode *PHI = cast<PHINode>(UI);
```

No need for a separate assert. Might be better to make the parameter a PHINode * instead to make the interface clearer (that this function only works if UI is a phi).

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


More information about the llvm-commits mailing list