1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -mem2reg -S | \ 2*9880d681SAndroid Build Coastguard Worker; RUN: not grep "i32 1" 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; When propagating the load through the select, make sure that the load is 5*9880d681SAndroid Build Coastguard Worker; inserted where the original load was, not where the select is. Not doing 6*9880d681SAndroid Build Coastguard Worker; so could produce incorrect results! 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Workerdefine i32 @test(i1 %C) { 9*9880d681SAndroid Build Coastguard Worker %X = alloca i32 ; <i32*> [#uses=3] 10*9880d681SAndroid Build Coastguard Worker %X2 = alloca i32 ; <i32*> [#uses=2] 11*9880d681SAndroid Build Coastguard Worker store i32 1, i32* %X 12*9880d681SAndroid Build Coastguard Worker store i32 2, i32* %X2 13*9880d681SAndroid Build Coastguard Worker %Y = select i1 %C, i32* %X, i32* %X2 ; <i32*> [#uses=1] 14*9880d681SAndroid Build Coastguard Worker store i32 3, i32* %X 15*9880d681SAndroid Build Coastguard Worker %Z = load i32, i32* %Y ; <i32> [#uses=1] 16*9880d681SAndroid Build Coastguard Worker ret i32 %Z 17*9880d681SAndroid Build Coastguard Worker} 18*9880d681SAndroid Build Coastguard Worker 19