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

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 10:06:05 PDT 2017


Ah, I missed the main point here and did some misreading. For some reason I thought the issue was with how far I was looping back, not the number of times that I check if LR is available.

> On Sep 22, 2017, at 9:54 AM, Quentin Colombet <qcolombet at apple.com> wrote:
> 
> 
> 
>> 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