summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/icmp-add.ll
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-02-18 22:20:09 +0000
committerSanjay Patel <spatel@rotateright.com>2017-02-18 22:20:09 +0000
commit53c5c3d65df3d48fd147b7786ef56cf9da6548d2 (patch)
tree0289773ebb088597a27473e757ed1db508c56821 /llvm/test/Transforms/InstCombine/icmp-add.ll
parentfe67255961e25c1d88888831d5badb3ec96b4ba2 (diff)
downloadbcm5719-llvm-53c5c3d65df3d48fd147b7786ef56cf9da6548d2.tar.gz
bcm5719-llvm-53c5c3d65df3d48fd147b7786ef56cf9da6548d2.zip
[InstCombine] add nsw/nuw X, signbit --> or X, signbit
Changing to 'or' (rather than 'xor' when no wrapping flags are set) allows icmp simplifies to happen as expected. Differential Revision: https://reviews.llvm.org/D29729 llvm-svn: 295574
Diffstat (limited to 'llvm/test/Transforms/InstCombine/icmp-add.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/icmp-add.ll10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp-add.ll b/llvm/test/Transforms/InstCombine/icmp-add.ll
index 7345621045d..efeb9d5bb45 100644
--- a/llvm/test/Transforms/InstCombine/icmp-add.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-add.ll
@@ -223,24 +223,22 @@ define i1 @nsw_slt5_ov(i8 %a) {
ret i1 %c
}
-; FIXME: InstCombine should not lose wrapping information by changing the add to xor.
+; InstCombine should not thwart this opportunity to simplify completely.
define i1 @slt_zero_add_nsw_signbit(i8 %x) {
; CHECK-LABEL: @slt_zero_add_nsw_signbit(
-; CHECK-NEXT: [[Z:%.*]] = icmp sgt i8 %x, -1
-; CHECK-NEXT: ret i1 [[Z]]
+; CHECK-NEXT: ret i1 true
;
%y = add nsw i8 %x, -128
%z = icmp slt i8 %y, 0
ret i1 %z
}
-; FIXME: InstCombine should not lose wrapping information by changing the add to xor.
+; InstCombine should not thwart this opportunity to simplify completely.
define i1 @slt_zero_add_nuw_signbit(i8 %x) {
; CHECK-LABEL: @slt_zero_add_nuw_signbit(
-; CHECK-NEXT: [[Z:%.*]] = icmp sgt i8 %x, -1
-; CHECK-NEXT: ret i1 [[Z]]
+; CHECK-NEXT: ret i1 true
;
%y = add nuw i8 %x, 128
%z = icmp slt i8 %y, 0
OpenPOWER on IntegriCloud