| ; Test merging of blocks containing complex expressions, |
| ; with various folding thresholds |
| ; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=1 | grep N: |
| ; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=2 | not grep N: |
| ; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=2 | grep M: |
| ; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=7 | not grep M: |
| define i32 @test(i1 %a, i1 %b, i32 %i, i32 %j, i32 %k) { |
| br i1 %a, label %M, label %O |
| br i1 %b, label %P, label %Q |
| %iajak = add i32 %iaj, %k |
| %ixjxk = xor i32 %ixj, %k |
| ; This phi should be foldable if threshold >= 2 |
| %Wp = phi i32 [ %iajak, %P ], [ %ixjxk, %Q ] |
| ; This phi should be foldable if threshold >= 7 |
| %W = phi i32 [ %Wp2, %N ], [ 2, %entry ] |