diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -1073,7 +1073,7 @@ // Get the value we are storing into the global, then merge it. mergeInValue(I->second, GV, getValueState(SI.getOperand(0))); - if (isOverdefined(I->second)) + if (I->second.isOverdefined()) TrackedGlobals.erase(I); // No need to keep tracking this! } @@ -1086,7 +1086,7 @@ // ResolvedUndefsIn might mark I as overdefined. Bail out, even if we would // discover a concrete value later. - if (isOverdefined(ValueState[&I])) + if (ValueState[&I].isOverdefined()) return (void)markOverdefined(&I); ValueLatticeElement PtrVal = getValueState(I.getOperand(0)); @@ -1114,7 +1114,8 @@ // If we are tracking this global, merge in the known value for it. auto It = TrackedGlobals.find(GV); if (It != TrackedGlobals.end()) { - mergeInValue(IV, &I, It->second); + mergeInValue(IV, &I, It->second, + ValueLatticeElement::MergeOptions().setCheckWiden(false)); return; } } diff --git a/llvm/test/Transforms/SCCP/load-store-range.ll b/llvm/test/Transforms/SCCP/load-store-range.ll --- a/llvm/test/Transforms/SCCP/load-store-range.ll +++ b/llvm/test/Transforms/SCCP/load-store-range.ll @@ -8,14 +8,10 @@ define void @test1a() { ; CHECK-LABEL: @test1a( ; CHECK-NEXT: [[X:%.*]] = load i32, i32* @G -; CHECK-NEXT: [[T_1:%.*]] = icmp ne i32 [[X]], 124 -; CHECK-NEXT: call void @use(i1 [[T_1]]) -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i32 [[X]], 124 -; CHECK-NEXT: call void @use(i1 [[T_2]]) -; CHECK-NEXT: [[F_1:%.*]] = icmp eq i32 [[X]], 124 -; CHECK-NEXT: call void @use(i1 [[F_1]]) -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i32 [[X]], 123 -; CHECK-NEXT: call void @use(i1 [[F_2]]) +; CHECK-NEXT: call void @use(i1 true) +; CHECK-NEXT: call void @use(i1 true) +; CHECK-NEXT: call void @use(i1 false) +; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i32 [[X]], 20 ; CHECK-NEXT: call void @use(i1 [[C_1]]) ; CHECK-NEXT: ret void @@ -59,14 +55,10 @@ define void @test2a() { ; CHECK-LABEL: @test2a( ; CHECK-NEXT: [[X:%.*]] = load i32, i32* @H -; CHECK-NEXT: [[T_1:%.*]] = icmp ne i32 [[X]], 124 -; CHECK-NEXT: call void @use(i1 [[T_1]]) -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i32 [[X]], 124 -; CHECK-NEXT: call void @use(i1 [[T_2]]) -; CHECK-NEXT: [[F_1:%.*]] = icmp eq i32 [[X]], 124 -; CHECK-NEXT: call void @use(i1 [[F_1]]) -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i32 [[X]], 123 -; CHECK-NEXT: call void @use(i1 [[F_2]]) +; CHECK-NEXT: call void @use(i1 true) +; CHECK-NEXT: call void @use(i1 true) +; CHECK-NEXT: call void @use(i1 false) +; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i32 [[X]], 20 ; CHECK-NEXT: call void @use(i1 [[C_1]]) ; CHECK-NEXT: ret void @@ -123,14 +115,10 @@ define void @test3a() { ; CHECK-LABEL: @test3a( ; CHECK-NEXT: [[X:%.*]] = load i32, i32* @I -; CHECK-NEXT: [[T_1:%.*]] = icmp ne i32 [[X]], 124 -; CHECK-NEXT: call void @use(i1 [[T_1]]) -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i32 [[X]], 124 -; CHECK-NEXT: call void @use(i1 [[T_2]]) -; CHECK-NEXT: [[F_1:%.*]] = icmp eq i32 [[X]], 124 -; CHECK-NEXT: call void @use(i1 [[F_1]]) -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i32 [[X]], 123 -; CHECK-NEXT: call void @use(i1 [[F_2]]) +; CHECK-NEXT: call void @use(i1 true) +; CHECK-NEXT: call void @use(i1 true) +; CHECK-NEXT: call void @use(i1 false) +; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i32 [[X]], 20 ; CHECK-NEXT: call void @use(i1 [[C_1]]) ; CHECK-NEXT: ret void diff --git a/llvm/test/Transforms/SCCP/resolvedundefsin-tracked-fn.ll b/llvm/test/Transforms/SCCP/resolvedundefsin-tracked-fn.ll --- a/llvm/test/Transforms/SCCP/resolvedundefsin-tracked-fn.ll +++ b/llvm/test/Transforms/SCCP/resolvedundefsin-tracked-fn.ll @@ -386,10 +386,7 @@ ; CHECK-NEXT: store i32 [[MUL]], i32* @pcount, align 4 ; CHECK-NEXT: ret void ; CHECK: if.end24: -; CHECK-NEXT: [[CMP25474:%.*]] = icmp sgt i32 [[TMP2]], 0 -; CHECK-NEXT: br i1 [[CMP25474]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] -; CHECK: for.body: -; CHECK-NEXT: ret void +; CHECK-NEXT: br label [[FOR_END:%.*]] ; CHECK: for.end: ; CHECK-NEXT: ret void ;