1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=instcombine -S < %s | FileCheck %s
4 ; Test that presence of range does not cause unprofitable transforms with bit
7 define i1 @without_range(ptr %A) {
8 ; CHECK-LABEL: @without_range(
9 ; CHECK-NEXT: [[A_VAL:%.*]] = load i32, ptr [[A:%.*]], align 8
10 ; CHECK-NEXT: [[C:%.*]] = icmp slt i32 [[A_VAL]], 2
11 ; CHECK-NEXT: ret i1 [[C]]
13 %A.val = load i32, ptr %A, align 8
14 %B = sdiv i32 %A.val, 2
15 %C = icmp sge i32 0, %B
19 define i1 @with_range(ptr %A) {
20 ; CHECK-LABEL: @with_range(
21 ; CHECK-NEXT: [[A_VAL:%.*]] = load i32, ptr [[A:%.*]], align 8, !range [[RNG0:![0-9]+]]
22 ; CHECK-NEXT: [[C:%.*]] = icmp samesign ult i32 [[A_VAL]], 2
23 ; CHECK-NEXT: ret i1 [[C]]
25 %A.val = load i32, ptr %A, align 8, !range !0
26 %B = sdiv i32 %A.val, 2
27 %C = icmp sge i32 0, %B
31 !0 = !{i32 0, i32 2147483647}