Index: lib/Transforms/Scalar/SCCP.cpp =================================================================== --- lib/Transforms/Scalar/SCCP.cpp +++ lib/Transforms/Scalar/SCCP.cpp @@ -1504,9 +1504,8 @@ // Otherwise, it is a branch on a symbolic value which is currently // considered to be undef. Handle this by forcing the input value to the - // branch to false. - markForcedConstant(BI->getCondition(), - ConstantInt::getFalse(TI->getContext())); + // branch to overdefined. + markOverdefined(BI->getCondition()); return true; } Index: test/Transforms/SCCP/apint-ipsccp3.ll =================================================================== --- test/Transforms/SCCP/apint-ipsccp3.ll +++ test/Transforms/SCCP/apint-ipsccp3.ll @@ -1,8 +1,24 @@ -; RUN: opt < %s -ipsccp -S | not grep global - -@G = internal global i66 undef +; RUN: opt < %s -ipsccp -S | FileCheck %s +; CHECK: @G = internal global i66 undef +; CHECK: define void @foo() { +; CHECK: %X = load i66, i66* @G +; CHECK: store i66 %X, i66* @G +; CHECK: ret void +; CHECK: } +; CHECK: define i66 @bar() { +; CHECK: %V = load i66, i66* @G +; CHECK: %C = icmp eq i66 %V, 17 +; CHECK: br i1 %C, label %T, label %F +; CHECK: T: +; CHECK: store i66 17, i66* @G +; CHECK: ret i66 %V +; CHECK: F: +; CHECK: store i66 123, i66* @G +; CHECK: ret i66 0 +; CHECK: } +@G = internal global i66 undef define void @foo() { %X = load i66, i66* @G Index: test/Transforms/SCCP/ipsccp-basic.ll =================================================================== --- test/Transforms/SCCP/ipsccp-basic.ll +++ test/Transforms/SCCP/ipsccp-basic.ll @@ -55,8 +55,9 @@ ret void } ; CHECK-LABEL: define void @test3a( -; CHECK-NEXT: ret void - +; CHECK-NEXT: %X = load i32, i32* @G +; CHECK-NEXT: store i32 %X, i32* @G +; CHECK-NEXT: ret void define i32 @test3b() { %V = load i32, i32* @G @@ -70,7 +71,8 @@ ret i32 0 } ; CHECK-LABEL: define i32 @test3b( -; CHECK-NOT: store +; CHECK: store i32 17, i32* @G +; CHECK: store i32 123, i32* @G ; CHECK: ret i32 0