[llvm] Unroll loops apple (PR #149358)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 11:50:02 PDT 2025


================
@@ -4821,9 +4821,16 @@ getAppleRuntimeUnrollPreferences(Loop *L, ScalarEvolution &SE,
         const SCEV *PtrSCEV = SE.getSCEV(Ptr);
         if (SE.isLoopInvariant(PtrSCEV, L))
           continue;
-        if (isa<LoadInst>(&I))
-          LoadedValues.insert(&I);
-        else
+        if (isa<LoadInst>(&I)) {
+          LoadedValuesPlus.insert(&I);
+          // Included 1st users of loaded values
+          for (auto *U : I.users()) {
+            auto *Inst = dyn_cast<Instruction>(U);
+            if (!Inst || Inst->getParent() != BB)
+              continue;
+            LoadedValuesPlus.insert(U);
----------------
fhahn wrote:

Is there any benefit from have a second set or can it just be one?

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


More information about the llvm-commits mailing list