23 lines · plain
1; Mem2reg should not insert dead PHI nodes! The naive algorithm inserts a PHI2; node in L3, even though there is no load of %A in anything dominated by L3.3 4; RUN: opt < %s -passes=mem2reg -S | not grep phi5 6define void @test(i32 %B, i1 %C) {7 %A = alloca i32 ; <ptr> [#uses=4]8 store i32 %B, ptr %A9 br i1 %C, label %L1, label %L210L1: ; preds = %011 store i32 %B, ptr %A12 %D = load i32, ptr %A ; <i32> [#uses=1]13 call void @test( i32 %D, i1 false )14 br label %L315L2: ; preds = %016 %E = load i32, ptr %A ; <i32> [#uses=1]17 call void @test( i32 %E, i1 true )18 br label %L319L3: ; preds = %L2, %L120 ret void21}22 23