[LLVMdev] which LLVM transforms can optimize this code?
Jun Koi
junkoi2004 at gmail.com
Sat Aug 11 05:21:40 PDT 2012
On Sat, Aug 11, 2012 at 7:42 PM, Jun Koi <junkoi2004 at gmail.com> wrote:
> 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?
i have some doubts here:
- i only tried to optimize code with transforms (see the list
http://llvm.org/docs/Passes.html#transforms). do i need to combine
that with analysis passes (http://llvm.org/docs/Passes.html#analyses),
or only transforms will do? if combination is necessary, how to
combine?
- i guess another reason that line (1) was not removed because i run
the tranforms only once. do i need to run transforms in many rounds,
and in different order to have better optimized code?
many thanks,
Jun
More information about the llvm-dev
mailing list