[LLVMdev] Question about Constant Expressions

Ben Chambers bjchambers at gmail.com
Tue Jul 3 09:56:09 PDT 2007


Hi!

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).

Thanks,
Ben Chambers



More information about the llvm-dev mailing list