[llvm] [LV] Stengthen loop-invariance checks in isPredicatedInst (PR #140744)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue May 20 23:52:12 PDT 2025


================
@@ -3102,14 +3102,14 @@ bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I) const {
     // is correct.  The easiest form of the later is to require that all values
     // stored are the same.
     return !(Legal->isInvariant(getLoadStorePointerOperand(I)) &&
-             TheLoop->isLoopInvariant(cast<StoreInst>(I)->getValueOperand()));
+             Legal->isInvariant(cast<StoreInst>(I)->getValueOperand()));
   }
   case Instruction::UDiv:
   case Instruction::SDiv:
   case Instruction::SRem:
   case Instruction::URem:
     // If the divisor is loop-invariant no predication is needed.
-    return !TheLoop->isLoopInvariant(I->getOperand(1));
----------------
fhahn wrote:

missing test coverage?

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


More information about the llvm-commits mailing list