[LLVMdev] rematerialization question

Heikki Kultala hkultala at iki.fi
Thu Mar 15 07:31:50 PDT 2012


I am a bit confused how the rematerialization works.

It seems currently in our backend we get lots of code where some stack 
offset address is calculated, but this address is then spilled to stack, 
and loaded from stack later.

This does not make sense, it would be better to just recalculate the 
address later, ie rematerialize the original stack offset calculation.

But marking some instruction rematerializable means all operands have to 
be always available?

So I cannot make my add operation which is used for the stack offset 
calculations rematerializable because not all operands of all adds are 
always available?


So how can I make llvm to try to rematerialize only those stack offset 
adds, but not all adds?

And also, when I have the stack update code in beginning and at end of 
the functions, these stack+immediate adds/subs also should not be 
rematerialized as the sp has changed?



More information about the llvm-dev mailing list