SimplifyCFG

Hello,

in the description of SimplifyCFG, it says that it can "Eliminates PHI nodes for basic blocks with a single predecessor."

I tested this pass with a program that has phi nodes with a single predecessor and it did not remove it. I also looked in the code and found nothing to remove it. I'm I missing something, or it does not remove phis with a single predecessor?

My sample is attached.

test.o (1 KB)

2009/8/28 Andre Tavares <andrelct@dcc.ufmg.br>

Hello,

in the description of SimplifyCFG, it says that it can “Eliminates PHI nodes for basic blocks with a single predecessor.”

I tested this pass with a program that has phi nodes with a single predecessor and it did not remove it. I also looked in the code and found nothing to remove it. I’m I missing something, or it does not remove phis with a single predecessor?

This is probably better discussed in a bug report. I only took a brief look, but it looks like the problem is triggered by the CFG being diamond-shaped. The attached x.bc is a simpler testcase that also demonstrates the missed-optimization.

Nick

x.bc (284 Bytes)