[LLVMdev] Getting rid of phi instructions?

Teemu Rinta-aho teemu.rinta-aho at nomadiclab.com
Tue Aug 30 09:12:26 PDT 2011


Hi all,

is there a pass to get rid of phi-instructions in a function? There's no loop involved.

I have a function approx. like this:

void @func() {
entry:
	…
bb1:
	…
bb2:
	…
	%tmp100 = phi i32 [ 0, bb1 ], [ 1, bb2 ] …
	%tmp101 = getelementptr …, %tmp100
	tail call void @anotherfunc(…, %tmp101)
	ret void
}

I would like it to rather be something like this:

void @func() {
entry:
	…
bb1:
	...
	%tmp90 = getelementptr …, %tmp89
	tail call void @anotherfunc(%tmp90)
	ret void
bb2:
	…
	%tmp101 = getelementptr …, %tmp100
	tail call void @anotherfunc(%tmp101)
	ret void
}

Best regards,
Teemu

--
Teemu Rinta-aho                      Tel:    +358 9 299 3078
Ericsson Research                    Mobile: +358 40 562 3066
Oy L M Ericsson Ab                   Fax:    +358 9 299 3535
02420 Jorvas, Finland                E-mail: teemu.rinta-aho at nomadiclab.com





More information about the llvm-dev mailing list