[LLVMdev] which LLVM transforms can optimize this code?

Jun Koi junkoi2004 at gmail.com
Sat Aug 11 04:42:16 PDT 2012


hi,

i am trying to optimize the below code, in one of my LLVM functions:

....
  store i32 96, i32* @XXX, align 4     ; (1)
  store i32 117, i32* @yyy, align 4    ; (2)
  store i32 31, i32* @XXX, align 4     ; (3)
....

naturally, optimize passes should remove the line (1), because later
line (3) overwrites the value of the same global variable XXX.
i run this code via "opt" with option "-O3", and indeed line (1) was removed.

but i want to do that in my code, without having to call "opt".
however, after trying a lot of transforms (at FunctionPassManager
level), line (1) is still there.

so i am wondering which passes (in the list
http://llvm.org/docs/Passes.html#transforms) can remove line (1)
above?

thanks,
Jun



More information about the llvm-dev mailing list