diff options
-rw-r--r-- | llvm/lib/IR/ConstantRange.cpp | 2 | ||||
-rw-r--r-- | llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp index 4914c50c203..18d8e9d42c6 100644 --- a/llvm/lib/IR/ConstantRange.cpp +++ b/llvm/lib/IR/ConstantRange.cpp @@ -824,6 +824,8 @@ ConstantRange ConstantRange::overflowingBinaryOp(Instruction::BinaryOps BinOp, switch (BinOp) { case Instruction::Add: return addWithNoWrap(Other, NoWrapKind); + case Instruction::Sub: + return subWithNoWrap(Other, NoWrapKind); default: // Don't know about this Overflowing Binary Operation. // Conservatively fallback to plain binop handling. diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll b/llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll index 6ec996ff941..8f783f82847 100644 --- a/llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll +++ b/llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll @@ -490,11 +490,9 @@ define i1 @test16(i32 %a, i32 %b) { ; CHECK-NEXT: [[SUB:%.*]] = sub nuw nsw i32 [[A]], [[B]] ; CHECK-NEXT: br label [[CONT:%.*]] ; CHECK: cont: -; CHECK-NEXT: [[RES:%.*]] = icmp sge i32 [[SUB]], 0 ; CHECK-NEXT: br label [[EXIT]] ; CHECK: exit: -; CHECK-NEXT: [[IV:%.*]] = phi i1 [ true, [[BEGIN:%.*]] ], [ [[RES]], [[CONT]] ] -; CHECK-NEXT: ret i1 [[IV]] +; CHECK-NEXT: ret i1 true ; begin: %cmp0 = icmp sge i32 %a, 0 @@ -598,11 +596,9 @@ define i1 @test19(i32 %a, i32 %b) { ; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 [[A]], [[B]] ; CHECK-NEXT: br label [[CONT:%.*]] ; CHECK: cont: -; CHECK-NEXT: [[RES:%.*]] = icmp sle i32 [[SUB]], 0 ; CHECK-NEXT: br label [[EXIT]] ; CHECK: exit: -; CHECK-NEXT: [[IV:%.*]] = phi i1 [ true, [[BEGIN:%.*]] ], [ [[RES]], [[CONT]] ] -; CHECK-NEXT: ret i1 [[IV]] +; CHECK-NEXT: ret i1 true ; begin: %cmp0 = icmp sle i32 %a, 0 |