kparzysz wrote:

> @kparzysz please take a loo at 
> https://gist.github.com/fhahn/67937125b64440a8a414909c4a1b7973, which has 
> much more limited impact.

If it's an urgent issue, then it's fine to have a limited-impact fix.  I think 
the root issue still remains though.

> If LR isn't marked as live in that case, other passes are free to clobber LR 
> (e.g. the machine-outliner by introducing calls using BL, as in 
> https://github.com/llvm/llvm-project/blob/20f634f275b431ff256ba45cbcbb6dc5bd945fb3/llvm/test/CodeGen/Thumb2/outlined-fn-may-clobber-lr-in-caller.ll

Does the outliner run after PEI?  If the callee has to ensure the correct value 
of the LR before returning (via a tail call for example), then the PEI code 
should take care of that.  It would see the call to the outlined procedure and 
do the right thing.  After PEI the liveness of LR needs to be accurately 
reflected and tail calls could (should?) always "use" LR.  That would either 
prevent outlining or cause the outliner to preserve LR across introduced calls.

On the caller side, the call instruction clobbers LR, so it can't really be 
considered live-out (unless the calling convention requires it to be preserved, 
which I think it doesn't).

https://github.com/llvm/llvm-project/pull/73553
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to