[llvm-dev] scheduling across calls to avoid spills
Davis, Alan via llvm-dev
llvm-dev at lists.llvm.org
Fri Oct 11 09:09:20 PDT 2019
I have some machine code that looks something like:
flag = true
c = call()
if (c)
flag = false
...
...
if (flag) ...
The 'flag' variable is a Boolean value of type i1. The target has 1-bit condition registers but none are preserved across calls. So flag is spilled to memory, resulting in terrible code.
There is no dependency between the flag=true instruction and the call, so I'd like to move it after the call. I was hoping the front end would do it via TargetTransformInfo::getCostOfKeepingLiveOverCall. But apparently that only applies to vectorization transforms.
The pre-RA MachineScheduler won't do it either, because scheduling regions are delimited by calls. (From MachineScheduler.cpp: "MachineScheduler does not currently support scheduling across calls.")
Is there some standard way in the front end or codegen to make this happen?
-Alan
More information about the llvm-dev
mailing list