[llvm] [LV] Don't predicate divs with invariant divisor when folding tail (PR #98904)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 03:34:38 PDT 2024


================
@@ -3348,40 +3348,48 @@ bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I) const {
     return false;
 
   // Can we prove this instruction is safe to unconditionally execute?
-  // If not, we must use some form of predication.
+  if (I->getOpcode() == Instruction::Call)
+    return Legal->isMaskRequired(I);
+
+  if (isa<LoadInst, StoreInst>(I) && !Legal->isMaskRequired(I))
+    return false;
+
+  // TODO: We can use the loop-preheader as context point here and get
+  // context sensitive reasoning
----------------
ayalz wrote:

```suggestion
  // context sensitive reasoning.
```
would be good to indicate that the comment refers to isSafeToSpeculativelyExecute(I), i.e., is `I` safe to speculatively execute in the preheader.

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


More information about the llvm-commits mailing list