[LLVMdev] Question about Constant Expressions

Chris Lattner sabre at nondot.org
Tue Jul 3 12:19:54 PDT 2007


On Tue, 3 Jul 2007, Ben Chambers wrote:
> Is there a pass that will remove constant expressions from appearing
> within other expressions?  For instance it would convert the call:
>  %tmp20 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x
> i8]* @.str, i32 0, i32 0), i32 %tmp18 )   ; <i32> [#uses=0]
>
> Into:
>  %tmpFresh = getelementptr [4 x i8]* @.str, i32 0, i32 0 ; <i8*> [#uses = 1]
>  %tmp20 = tail call i32 (i8*, ...)* @printf( i8* %tmpFresh, i32
> %tmp18 )   ; <i32> [#uses=0]
>
> (Ideally it would do this as an .s -> .s transformation and be
> accessible through a tool like opt).

We used to have a 'lowerconstantexpr' pass in transforms/scalar.  I don't 
know how to see deleted files in svn though.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list