11; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2- ; RUN: opt < %s -instcombine -S | FileCheck %s
2+ ; RUN: opt < %s -instcombine -expensive-combines=0 -S | FileCheck %s --check-prefixes=CHECK,EXPENSIVE-OFF
3+ ; RUN: opt < %s -instcombine -expensive-combines=1 -S | FileCheck %s --check-prefixes=CHECK,EXPENSIVE-ON
34
45; Result of left shifting a non-negative integer
56; with nsw flag should also be non-negative
@@ -29,8 +30,12 @@ define i1 @test_shift_negative(i32 %a, i32 %b) {
2930; If sign bit is a known zero, it cannot be a known one.
3031; This test should not crash opt. The shift produces poison.
3132define i32 @test_no_sign_bit_conflict1 (i1 %b ) {
32- ; CHECK-LABEL: @test_no_sign_bit_conflict1(
33- ; CHECK-NEXT: ret i32 0
33+ ; EXPENSIVE-OFF-LABEL: @test_no_sign_bit_conflict1(
34+ ; EXPENSIVE-OFF-NEXT: [[SEL:%.*]] = select i1 [[B:%.*]], i32 -2147221504, i32 -2147483648
35+ ; EXPENSIVE-OFF-NEXT: ret i32 [[SEL]]
36+ ;
37+ ; EXPENSIVE-ON-LABEL: @test_no_sign_bit_conflict1(
38+ ; EXPENSIVE-ON-NEXT: ret i32 0
3439;
3540 %sel = select i1 %b , i32 8193 , i32 8192
3641 %mul = shl nsw i32 %sel , 18
@@ -40,8 +45,12 @@ define i32 @test_no_sign_bit_conflict1(i1 %b) {
4045; If sign bit is a known one, it cannot be a known zero.
4146; This test should not crash opt. The shift produces poison.
4247define i32 @test_no_sign_bit_conflict2 (i1 %b ) {
43- ; CHECK-LABEL: @test_no_sign_bit_conflict2(
44- ; CHECK-NEXT: ret i32 0
48+ ; EXPENSIVE-OFF-LABEL: @test_no_sign_bit_conflict2(
49+ ; EXPENSIVE-OFF-NEXT: [[SEL:%.*]] = select i1 [[B:%.*]], i32 2147221504, i32 2146959360
50+ ; EXPENSIVE-OFF-NEXT: ret i32 [[SEL]]
51+ ;
52+ ; EXPENSIVE-ON-LABEL: @test_no_sign_bit_conflict2(
53+ ; EXPENSIVE-ON-NEXT: ret i32 0
4554;
4655 %sel = select i1 %b , i32 -8193 , i32 -8194
4756 %mul = shl nsw i32 %sel , 18
0 commit comments