[llvm] Adding the support for vectorization of loops with load based tripcount (PR #209390)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 00:29:59 PDT 2026


================
@@ -7891,34 +7888,28 @@ bool EnableLoadBoundVectorization(Loop *L, PredicatedScalarEvolution &PSE,
   for (Instruction *I : HoistedDeps) {
     Instruction *Clone = I->clone();
     Clone->setName(I->getName() + ".bound.pre");
-    for (Use &U : Clone->operands()) {
-      if (auto *OpI = dyn_cast<Instruction>(U.get())) {
-        if (L->contains(OpI)) {
+    for (Use &U : Clone->operands())
+      if (auto *OpI = dyn_cast<Instruction>(U.get()))
+        if (L->contains(OpI))
           U.set(CloneMap[OpI]);
-        }
-      }
-    }
     Clone->insertBefore(InsertPt->getIterator());
     CloneMap[I] = Clone;
   }
 
   bool Added = false;
   for (LoadInst *LI : BoundLoads) {
-    auto It = CloneMap.find(LI);
-    if (It == CloneMap.end()) {
+    Value *V = CloneMap.lookup(LI);
+    if (!V)
       continue;
-    }
     const SCEV *LoadSCEV = SE->getSCEV(LI);
-    const SCEV *InvSCEV = SE->getSCEV(It->second);
-    if (!isa<SCEVUnknown>(LoadSCEV)) {
+    const SCEV *InvSCEV = SE->getSCEV(V);
+    if (!isa<SCEVUnknown>(LoadSCEV))
       continue;
-    }
     PSE.addAssumption(SE->getEqualPredicate(LoadSCEV, InvSCEV));
     Added = true;
   }
-  if (!Added) {
+  if (!Added)
----------------
david-arm wrote:

Why are there so many formatting changes?

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


More information about the llvm-commits mailing list