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: opt < %s -mem2reg -S | not grep phi 5 6 define void @test(i32 %B, i1 %C) { 7 %A = alloca i32 ; <i32*> [#uses=4] 8 store i32 %B, i32* %A 9 br i1 %C, label %L1, label %L2 10 L1: ; preds = %0 11 store i32 %B, i32* %A 12 %D = load i32* %A ; <i32> [#uses=1] 13 call void @test( i32 %D, i1 false ) 14 br label %L3 15 L2: ; preds = %0 16 %E = load i32* %A ; <i32> [#uses=1] 17 call void @test( i32 %E, i1 true ) 18 br label %L3 19 L3: ; preds = %L2, %L1 20 ret void 21 } 22 23