| Chris Lattner | 0ac801e | 2003-10-05 21:11:57 +0000 | [diff] [blame^] | 1 | ; Mem2reg should not insert dead PHI nodes! The naive algorithm inserts a PHI |
| 2 | ; node in L3, even though there is no load of %A in anything dominated by L3. |
| 3 | |
| 4 | ; RUN: llvm-as < %s | opt -mem2reg | llvm-dis | not grep phi |
| 5 | |
| 6 | void %test(int %B, bool %C) { |
| 7 | %A = alloca int |
| 8 | store int %B, int* %A |
| 9 | br bool %C, label %L1, label %L2 |
| 10 | L1: |
| 11 | store int %B, int* %A |
| 12 | %D = load int* %A |
| 13 | call void %test(int %D, bool false) |
| 14 | br label %L3 |
| 15 | L2: |
| 16 | %E = load int* %A |
| 17 | call void %test(int %E, bool true) |
| 18 | br label %L3 |
| 19 | L3: |
| 20 | ret void |
| 21 | } |