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

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 09:54:01 PDT 2017



> On Sep 22, 2017, at 9:50 AM, Jessica Paquette via Phabricator <reviews at reviews.llvm.org> wrote:
> 
> 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);

I believe you need a backward loop calling this function, until you reach the insertion point.

> if (!LRU.available(AArch64::LR))
>    return false;
> ```
> 
> Is this incorrect?
> 
> 
> https://reviews.llvm.org/D36721
> 
> 
> 



More information about the llvm-commits mailing list