[llvm-dev] Live Register Spilling

jin chuan see via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 8 00:10:42 PDT 2017

Hi All,

I faced some problems while using the BuildMI().

Currently, i am trying to replace specific MI with a series of new MI.

I wrote a routine under the processFunctionAfterISel() to detect the targeted MI and replace it accordingly.

After using BuildMI() to perform my replacement, i realize there are unnecessary spilling and reloading of registers in the assembly generated.

By checking the llc debug output, i am suspecting that the virtual register states have been completely messed up.

This is because the spilling and reloading codes are only inserted at the register allocation phase, especially during the state of "Spilling live registers at the end of block".

These spilling and reloading codes are messing up the assembly generated, and the behavior of the code generated is undetermined.

I would like to know is there anything i can do to fix the virtual register use-def relationship?

Or is there any standard procedure i should follow to handle the MachineOperands while using BuildMI()?

Any opinions or suggestion are welcomed.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170908/31e3d390/attachment.html>

More information about the llvm-dev mailing list