summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/add.ll10
-rw-r--r--llvm/test/Transforms/InstCombine/icmp-add.ll10
2 files changed, 8 insertions, 12 deletions
diff --git a/llvm/test/Transforms/InstCombine/add.ll b/llvm/test/Transforms/InstCombine/add.ll
index c04953d1a41..73c786dcb26 100644
--- a/llvm/test/Transforms/InstCombine/add.ll
+++ b/llvm/test/Transforms/InstCombine/add.ll
@@ -267,24 +267,22 @@ define i32 @xor_sign_bit(i32 %x) {
ret i32 %add
}
-; Lose no-wrap info by converting to xor? %x is known non-negative
-; here, but not after converting to xor.
+; No-wrap info allows converting the add to 'or'.
define i8 @add_nsw_signbit(i8 %x) {
; CHECK-LABEL: @add_nsw_signbit(
-; CHECK-NEXT: [[Y:%.*]] = xor i8 %x, -128
+; CHECK-NEXT: [[Y:%.*]] = or i8 %x, -128
; CHECK-NEXT: ret i8 [[Y]]
;
%y = add nsw i8 %x, -128
ret i8 %y
}
-; Lose no-wrap info by converting to xor? %x is known non-negative
-; (x < 128 unsigned), but not after converting to xor.
+; No-wrap info allows converting the add to 'or'.
define i8 @add_nuw_signbit(i8 %x) {
; CHECK-LABEL: @add_nuw_signbit(
-; CHECK-NEXT: [[Y:%.*]] = xor i8 %x, -128
+; CHECK-NEXT: [[Y:%.*]] = or i8 %x, -128
; CHECK-NEXT: ret i8 [[Y]]
;
%y = add nuw i8 %x, 128
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