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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 31 02:20:58 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 = cast<Instruction>(U);
+            if (!Inst)
+              continue;
----------------
fhahn wrote:

```suggestion
```

This isn't needed with cast, `cast` will assert that the argument can be casted with assertions.

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


More information about the llvm-commits mailing list