[LLVMdev] Promote constant expressions to registers

Marcelo Sousa marceloabsousa at gmail.com
Sat Sep 28 10:17:36 PDT 2013


Hello,

Is there a way to generate LLVM IR without constant expressions by
promoting constant expressions to registers?

e.g.:
  %tmp1 = tail call i8* @foo(i8* bitcast (i32* @x to i8*), i8* %tmp, i64 4) #1
would be converted to:
  %tmp1 = bitcast i32* @x to i8*
  %tmp2 = tail call i8* @foo(i8* %tmp1, i8* %tmp, i64 4) #1

I find quite inconvenient and redundant to maintain constant
expressions when they are a subset of the instruction set. Are
constant expressions being highly exploited for a particular set of
optimizations?

Regards,
Marcelo



More information about the llvm-dev mailing list