19 lines · plain
1; RUN: opt < %s -passes='function(instcombine),function(mem2reg)' -S | \2; RUN: not grep "i32 1"3 4; When propagating the load through the select, make sure that the load is5; inserted where the original load was, not where the select is. Not doing6; so could produce incorrect results!7 8define i32 @test(i1 %C) {9 %X = alloca i32 ; <ptr> [#uses=3]10 %X2 = alloca i32 ; <ptr> [#uses=2]11 store i32 1, ptr %X12 store i32 2, ptr %X213 %Y = select i1 %C, ptr %X, ptr %X2 ; <ptr> [#uses=1]14 store i32 3, ptr %X15 %Z = load i32, ptr %Y ; <i32> [#uses=1]16 ret i32 %Z17}18 19