[LLVMdev] Remove redundant code after frame index elimination

Ivan Llopard ivanllopard at gmail.com
Fri Feb 10 04:47:00 PST 2012


Hi list,

I added custom code to eliminate frame index references. I replace each 
FI reference with a subtraction from my frame pointer register (just 
like ebp in x86). Its result is stored in another register which is used 
by the load/store instructions. Nevertheless, this operation gives me 
redundant subs that I would like to remove after all fi references have 
been eliminated. For example:

r = load fi<1> -->
{
   sp = subm fi, cst_offset
   r = load sp
}
...
store fi<1>, val -->
{
   sp = subm fi, cst_offset
   store sp, val
}

Any advice on what is the better solution to remove that code ? Should I 
create a custom pass after the prolog/epilog insertion one ?

Ivan



More information about the llvm-dev mailing list