Skip to content

Commit 89b0044

Browse files
committed
[InstSimplify] Add test for implied cond with equal ops and constant (NFC)
1 parent cd31cf5 commit 89b0044

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

llvm/test/Transforms/InstSimplify/implies.ll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,4 +499,30 @@ define i1 @lshr_value(i32 %length.i, i32 %i, i32 %v) {
499499
ret i1 %res
500500
}
501501

502+
define i1 @same_ops_with_constant(i8 %x) {
503+
; CHECK-LABEL: @same_ops_with_constant(
504+
; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[X:%.*]], 5
505+
; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 [[X]], 5
506+
; CHECK-NEXT: [[RES:%.*]] = icmp ule i1 [[CMP1]], [[CMP2]]
507+
; CHECK-NEXT: ret i1 [[RES]]
508+
;
509+
%cmp1 = icmp sgt i8 %x, 5
510+
%cmp2 = icmp ugt i8 %x, 5
511+
%res = icmp ule i1 %cmp1, %cmp2
512+
ret i1 %res
513+
}
514+
515+
define i1 @same_ops_with_constant_wrong_sign(i8 %x) {
516+
; CHECK-LABEL: @same_ops_with_constant_wrong_sign(
517+
; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[X:%.*]], -5
518+
; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 [[X]], -5
519+
; CHECK-NEXT: [[RES:%.*]] = icmp ule i1 [[CMP1]], [[CMP2]]
520+
; CHECK-NEXT: ret i1 [[RES]]
521+
;
522+
%cmp1 = icmp sgt i8 %x, -5
523+
%cmp2 = icmp ugt i8 %x, -5
524+
%res = icmp ule i1 %cmp1, %cmp2
525+
ret i1 %res
526+
}
527+
502528
declare void @llvm.assume(i1)

0 commit comments

Comments
 (0)