summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-05-31 20:48:26 +0000
committerNikita Popov <nikita.ppv@gmail.com>2019-05-31 20:48:26 +0000
commit7bafae55c01dda8478aeff74a8d657a4148630af (patch)
tree7c0b11691f9dbb847ce733ffd832d212973cca32 /llvm/test/Transforms
parentd43509305674e89e6ac482b5a76c2ac20c2de1c4 (diff)
downloadbcm5719-llvm-7bafae55c01dda8478aeff74a8d657a4148630af.tar.gz
bcm5719-llvm-7bafae55c01dda8478aeff74a8d657a4148630af.zip
Reapply [CVP] Simplify non-overflowing saturating add/sub
If we can determine that a saturating add/sub will not overflow based on range analysis, convert it into a simple binary operation. This is a sibling transform to the existing with.overflow handling. Reapplying this with an additional check that the saturating intrinsic has integer type, as LVI currently does not support vector types. Differential Revision: https://reviews.llvm.org/D62703 llvm-svn: 362263
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll16
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll b/llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll
index 66cd85abe97..04b1471ebb4 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll
@@ -752,8 +752,8 @@ define i8 @uadd_sat_no_overflow(i8 %x) {
; CHECK-NEXT: call void @llvm.trap()
; CHECK-NEXT: unreachable
; CHECK: cont:
-; CHECK-NEXT: [[RES:%.*]] = call i8 @llvm.uadd.sat.i8(i8 [[X]], i8 100)
-; CHECK-NEXT: ret i8 [[RES]]
+; CHECK-NEXT: [[RES1:%.*]] = add nuw i8 [[X]], 100
+; CHECK-NEXT: ret i8 [[RES1]]
;
%cmp = icmp ugt i8 %x, 100
br i1 %cmp, label %trap, label %cont
@@ -775,8 +775,8 @@ define i8 @sadd_sat_no_overflow(i8 %x) {
; CHECK-NEXT: call void @llvm.trap()
; CHECK-NEXT: unreachable
; CHECK: cont:
-; CHECK-NEXT: [[RES:%.*]] = call i8 @llvm.sadd.sat.i8(i8 [[X]], i8 20)
-; CHECK-NEXT: ret i8 [[RES]]
+; CHECK-NEXT: [[RES1:%.*]] = add nsw i8 [[X]], 20
+; CHECK-NEXT: ret i8 [[RES1]]
;
%cmp = icmp sgt i8 %x, 100
br i1 %cmp, label %trap, label %cont
@@ -798,8 +798,8 @@ define i8 @usub_sat_no_overflow(i8 %x) {
; CHECK-NEXT: call void @llvm.trap()
; CHECK-NEXT: unreachable
; CHECK: cont:
-; CHECK-NEXT: [[RES:%.*]] = call i8 @llvm.usub.sat.i8(i8 [[X]], i8 100)
-; CHECK-NEXT: ret i8 [[RES]]
+; CHECK-NEXT: [[RES1:%.*]] = sub nuw i8 [[X]], 100
+; CHECK-NEXT: ret i8 [[RES1]]
;
%cmp = icmp ult i8 %x, 100
br i1 %cmp, label %trap, label %cont
@@ -821,8 +821,8 @@ define i8 @ssub_sat_no_overflow(i8 %x) {
; CHECK-NEXT: call void @llvm.trap()
; CHECK-NEXT: unreachable
; CHECK: cont:
-; CHECK-NEXT: [[RES:%.*]] = call i8 @llvm.ssub.sat.i8(i8 [[X]], i8 20)
-; CHECK-NEXT: ret i8 [[RES]]
+; CHECK-NEXT: [[RES1:%.*]] = sub nsw i8 [[X]], 20
+; CHECK-NEXT: ret i8 [[RES1]]
;
%cmp = icmp slt i8 %x, -100
br i1 %cmp, label %trap, label %cont
OpenPOWER on IntegriCloud