[LLVMdev] Eliminating PHI with Identical Inputs

John Criswell criswell at illinois.edu
Tue Jul 30 07:12:29 PDT 2013


Dear All,

Is there a pass (or set of passes) that will replace a phi whose input 
operands all compute the same value with an instruction that computes 
that value?  In other words, something that will convert:

define internal i32 @function(i32 %x) {
...
bb1:
%y = add %x, 10
...
bb2:
%z = add %x, 10
...
bb3:
%phi = [bb1, %y], [bb2, %z]

into

define internal i32 @function(i32 %x) {
...
bb1:
...
bb2:
...
bb3:
%phi = add %x, 10

-- John T.




More information about the llvm-dev mailing list