diff --git a/llvm/lib/Transforms/Utils/SCCPSolver.cpp b/llvm/lib/Transforms/Utils/SCCPSolver.cpp --- a/llvm/lib/Transforms/Utils/SCCPSolver.cpp +++ b/llvm/lib/Transforms/Utils/SCCPSolver.cpp @@ -1436,7 +1436,7 @@ // If either of the operands is a constant, try to fold it to a constant. // TODO: Use information from notconstant better. - if ((V1State.isConstant() || V2State.isConstant())) { + if (SCCPSolver::isConstant(V1State) || SCCPSolver::isConstant(V2State)) { Value *V1 = SCCPSolver::isConstant(V1State) ? getConstant(V1State) : I.getOperand(0); Value *V2 = SCCPSolver::isConstant(V2State) ? getConstant(V2State) diff --git a/llvm/test/Transforms/SCCP/binaryops-range-special-cases.ll b/llvm/test/Transforms/SCCP/binaryops-range-special-cases.ll --- a/llvm/test/Transforms/SCCP/binaryops-range-special-cases.ll +++ b/llvm/test/Transforms/SCCP/binaryops-range-special-cases.ll @@ -102,8 +102,7 @@ ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[UREM_3:%.*]] = urem i16 12704, 0 -; CHECK-NEXT: [[C_5:%.*]] = icmp eq i16 [[UREM_3]], 1 +; CHECK-NEXT: [[C_5:%.*]] = icmp eq i16 undef, 1 ; CHECK-NEXT: call void @use(i1 [[C_5]]) ; CHECK-NEXT: ret void ; @@ -130,8 +129,7 @@ ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[SREM_3:%.*]] = urem i16 12704, 0 -; CHECK-NEXT: [[C_5:%.*]] = icmp eq i16 [[SREM_3]], 1 +; CHECK-NEXT: [[C_5:%.*]] = icmp eq i16 undef, 1 ; CHECK-NEXT: call void @use(i1 [[C_5]]) ; CHECK-NEXT: ret void ; diff --git a/llvm/test/Transforms/SCCP/ip-ranges-phis.ll b/llvm/test/Transforms/SCCP/ip-ranges-phis.ll --- a/llvm/test/Transforms/SCCP/ip-ranges-phis.ll +++ b/llvm/test/Transforms/SCCP/ip-ranges-phis.ll @@ -56,11 +56,11 @@ ; CHECK-NEXT: [[V_2:%.*]] = select i1 [[C_2]], i32 20, i32 200 ; CHECK-NEXT: [[V_3:%.*]] = select i1 [[C_3]], i32 30, i32 300 ; CHECK-NEXT: [[R_1:%.*]] = add nuw nsw i32 [[V_1]], [[V_2]] -; CHECK-NEXT: [[R_2:%.*]] = add nuw nsw i32 [[R_1]], [[V_3]] -; CHECK-NEXT: [[R_3:%.*]] = add nuw nsw i32 [[R_2]], 400 -; CHECK-NEXT: [[R_4:%.*]] = add nuw nsw i32 [[R_3]], 50 -; CHECK-NEXT: [[R_5:%.*]] = add nuw nsw i32 [[R_4]], 60 -; CHECK-NEXT: [[R_6:%.*]] = add nuw nsw i32 [[R_4]], 700 +; CHECK-NEXT: [[R_2:%.*]] = add i32 [[R_1]], [[V_3]] +; CHECK-NEXT: [[R_3:%.*]] = add i32 [[R_2]], 400 +; CHECK-NEXT: [[R_4:%.*]] = add i32 [[R_3]], 50 +; CHECK-NEXT: [[R_5:%.*]] = add i32 [[R_4]], 60 +; CHECK-NEXT: [[R_6:%.*]] = add i32 [[R_4]], 700 ; CHECK-NEXT: ret i32 [[R_6]] ; @@ -204,7 +204,7 @@ ; CHECK-NEXT: br label [[END]] ; CHECK: end: ; CHECK-NEXT: [[P1:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ 5, [[IF_TRUE]] ] -; CHECK-NEXT: [[CALL1:%.*]] = tail call i32 @f3(i32 [[P1]], i32 [[Y]], i1 [[CMP_1]]) +; CHECK-NEXT: [[CALL1:%.*]] = tail call i32 @f3(i32 [[P1]], i32 [[Y]], i1 [[CMP_1]]), !range [[RNG0:![0-9]+]] ; CHECK-NEXT: ret i32 [[CALL1]] ; diff --git a/llvm/test/Transforms/SCCP/overdefined-div.ll b/llvm/test/Transforms/SCCP/overdefined-div.ll --- a/llvm/test/Transforms/SCCP/overdefined-div.ll +++ b/llvm/test/Transforms/SCCP/overdefined-div.ll @@ -25,8 +25,7 @@ define i32 @test3(i32 %foo) { ; CHECK-LABEL: define i32 @test3 ; CHECK-SAME: (i32 [[FOO:%.*]]) { -; CHECK-NEXT: [[TINKYWINKY:%.*]] = udiv i32 [[FOO]], 0 -; CHECK-NEXT: ret i32 [[TINKYWINKY]] +; CHECK-NEXT: ret i32 undef ; %tinkywinky = udiv i32 %foo, 0 ret i32 %tinkywinky @@ -35,8 +34,7 @@ define i32 @test4(i32 %foo) { ; CHECK-LABEL: define i32 @test4 ; CHECK-SAME: (i32 [[FOO:%.*]]) { -; CHECK-NEXT: [[TINKYWINKY:%.*]] = sdiv i32 [[FOO]], 0 -; CHECK-NEXT: ret i32 [[TINKYWINKY]] +; CHECK-NEXT: ret i32 undef ; %tinkywinky = sdiv i32 %foo, 0 ret i32 %tinkywinky diff --git a/llvm/test/Transforms/SCCP/ub-shift.ll b/llvm/test/Transforms/SCCP/ub-shift.ll --- a/llvm/test/Transforms/SCCP/ub-shift.ll +++ b/llvm/test/Transforms/SCCP/ub-shift.ll @@ -3,10 +3,9 @@ define void @shift_undef_64(ptr %p) { ; CHECK-LABEL: @shift_undef_64( -; CHECK-NEXT: store i64 0, ptr [[P:%.*]], align 4 -; CHECK-NEXT: store i64 -1, ptr [[P]], align 4 -; CHECK-NEXT: [[R3:%.*]] = shl nuw nsw i64 -1, 4294967298 -; CHECK-NEXT: store i64 [[R3]], ptr [[P]], align 4 +; CHECK-NEXT: store i64 undef, ptr [[P:%.*]], align 4 +; CHECK-NEXT: store i64 undef, ptr [[P]], align 4 +; CHECK-NEXT: store i64 undef, ptr [[P]], align 4 ; CHECK-NEXT: ret void ; %r1 = lshr i64 -1, 4294967296 ; 2^32 @@ -23,10 +22,9 @@ define void @shift_undef_65(ptr %p) { ; CHECK-LABEL: @shift_undef_65( -; CHECK-NEXT: store i65 0, ptr [[P:%.*]], align 4 -; CHECK-NEXT: store i65 0, ptr [[P]], align 4 -; CHECK-NEXT: [[R3:%.*]] = shl nuw nsw i65 1, -18446744073709551615 -; CHECK-NEXT: store i65 [[R3]], ptr [[P]], align 4 +; CHECK-NEXT: store i65 undef, ptr [[P:%.*]], align 4 +; CHECK-NEXT: store i65 undef, ptr [[P]], align 4 +; CHECK-NEXT: store i65 undef, ptr [[P]], align 4 ; CHECK-NEXT: ret void ; %r1 = lshr i65 2, 18446744073709551617 @@ -43,10 +41,9 @@ define void @shift_undef_256(ptr %p) { ; CHECK-LABEL: @shift_undef_256( -; CHECK-NEXT: store i256 0, ptr [[P:%.*]], align 4 -; CHECK-NEXT: store i256 0, ptr [[P]], align 4 -; CHECK-NEXT: [[R3:%.*]] = shl nuw nsw i256 1, 18446744073709551619 -; CHECK-NEXT: store i256 [[R3]], ptr [[P]], align 4 +; CHECK-NEXT: store i256 undef, ptr [[P:%.*]], align 4 +; CHECK-NEXT: store i256 undef, ptr [[P]], align 4 +; CHECK-NEXT: store i256 undef, ptr [[P]], align 4 ; CHECK-NEXT: ret void ; %r1 = lshr i256 2, 18446744073709551617 @@ -63,10 +60,9 @@ define void @shift_undef_511(ptr %p) { ; CHECK-LABEL: @shift_undef_511( -; CHECK-NEXT: store i511 0, ptr [[P:%.*]], align 4 -; CHECK-NEXT: store i511 -1, ptr [[P]], align 4 -; CHECK-NEXT: [[R3:%.*]] = shl nuw nsw i511 -3, 1208925819614629174706180 -; CHECK-NEXT: store i511 [[R3]], ptr [[P]], align 4 +; CHECK-NEXT: store i511 undef, ptr [[P:%.*]], align 4 +; CHECK-NEXT: store i511 undef, ptr [[P]], align 4 +; CHECK-NEXT: store i511 undef, ptr [[P]], align 4 ; CHECK-NEXT: ret void ; %r1 = lshr i511 -1, 1208925819614629174706276 ; 2^80 + 100