1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -lsr-complexity-limit=50 -loop-reduce -S %s | FileCheck %s
4 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
6 define void @overflow1(i64 %a) {
7 ; CHECK-LABEL: @overflow1(
9 ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[A:%.*]], -1
10 ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[A]], -9223372036854775808
11 ; CHECK-NEXT: br label [[BB1:%.*]]
13 ; CHECK-NEXT: [[LSR_IV1:%.*]] = phi i64 [ [[LSR_IV_NEXT2:%.*]], [[BB1]] ], [ [[TMP1]], [[BB:%.*]] ]
14 ; CHECK-NEXT: [[LSR_IV:%.*]] = phi i64 [ [[LSR_IV_NEXT:%.*]], [[BB1]] ], [ [[TMP0]], [[BB]] ]
15 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i64 [[LSR_IV1]], 0
16 ; CHECK-NEXT: [[TMP5:%.*]] = and i1 [[TMP4]], true
17 ; CHECK-NEXT: [[LSR_IV_NEXT]] = add i64 [[LSR_IV]], 1
18 ; CHECK-NEXT: [[LSR_IV_NEXT2]] = add i64 [[LSR_IV1]], 1
19 ; CHECK-NEXT: br i1 [[TMP5]], label [[BB1]], label [[BB7:%.*]]
21 ; CHECK-NEXT: [[TMP9:%.*]] = and i64 [[LSR_IV_NEXT]], 1
22 ; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i64 [[TMP9]], 0
23 ; CHECK-NEXT: unreachable
28 bb1: ; preds = %bb1, %bb
29 %tmp = phi i64 [ %a, %bb ], [ %tmp6, %bb1 ]
30 %tmp4 = icmp ne i64 %tmp, -9223372036854775808
31 %tmp5 = and i1 %tmp4, 1
32 %tmp6 = add i64 %tmp, 1
33 br i1 %tmp5, label %bb1, label %bb7
36 %tmp9 = and i64 %tmp, 1
37 %tmp10 = icmp eq i64 %tmp9, 0