[PATCH] D36721: [MachineOutliner] AArch64: Avoid saving + restoring LR if possible

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 09:50:45 PDT 2017


paquette added inline comments.


================
Comment at: lib/Target/AArch64/AArch64InstrInfo.cpp:4548-4561
+  auto LRIsUnavailable = [&LRU](MachineInstr &MI) {
+    bool Ret = true;
+    if (LRU.available(AArch64::LR))
+      Ret = false;
+    LRU.stepBackward(MI);
+    return Ret;
+  };
----------------
MatzeB wrote:
> This still checks for LR being available for the whole range between the end of the basic block and `CallInsertionPt`. I would expect it to be enough to `stepBackward()` till CallInsertionPt and only then check if LR is unused.
I actually tried that, and the outliner ended up erroneously pulling out a bunch of things without saving LR.

I tried something like

```
LRU.stepBackward(*CallInsertionPt);
if (!LRU.available(AArch64::LR))
    return false;
```

Is this incorrect?


https://reviews.llvm.org/D36721





More information about the llvm-commits mailing list