[llvm] [AArch64] Tune unrolling prefs for more patterns on Apple CPUs (PR #149358)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 01:48:08 PDT 2025


================
@@ -4821,9 +4822,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)
----------------
fhahn wrote:

why does the instruction need to be in the same block? It should be sufficient if it is in the same loop? Suggests that we may need to add a test with multiple blocks.

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


More information about the llvm-commits mailing list