1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes='loop(indvars),verify' -S < %s | FileCheck %s
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
5 target triple = "x86_64-unknown-linux-gnu"
10 ; CHECK-NEXT: [[VAR:%.*]] = load atomic i32, ptr addrspace(1) poison unordered, align 8, !range [[RNG0:![0-9]+]], !invariant.load !1, !noundef !1
11 ; CHECK-NEXT: [[VAR2:%.*]] = icmp eq i32 [[VAR]], 0
12 ; CHECK-NEXT: br i1 [[VAR2]], label [[BB18:%.*]], label [[BB19:%.*]]
14 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[BB19]] ], [ [[INDVARS_IV_NEXT:%.*]], [[BB12:%.*]] ]
15 ; CHECK-NEXT: br i1 true, label [[BB8:%.*]], label [[BB7:%.*]]
17 ; CHECK-NEXT: ret void
19 ; CHECK-NEXT: [[VAR9:%.*]] = load atomic i32, ptr addrspace(1) poison unordered, align 8, !range [[RNG0]], !invariant.load !1, !noundef !1
20 ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[VAR9]] to i64
21 ; CHECK-NEXT: [[VAR10:%.*]] = icmp ult i64 [[INDVARS_IV]], [[TMP0]]
22 ; CHECK-NEXT: br i1 [[VAR10]], label [[BB12]], label [[BB11:%.*]]
24 ; CHECK-NEXT: ret void
26 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
27 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[TMP1:%.*]]
28 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[BB3:%.*]], label [[BB17:%.*]]
30 ; CHECK-NEXT: unreachable
32 ; CHECK-NEXT: ret void
34 ; CHECK-NEXT: [[TMP1]] = zext i32 [[VAR]] to i64
35 ; CHECK-NEXT: br label [[BB3]]
38 %var = load atomic i32, ptr addrspace(1) poison unordered, align 8, !range !0, !invariant.load !1, !noundef !1
39 %var1 = add nsw i32 %var, -1
40 %var2 = icmp eq i32 %var, 0
41 br i1 %var2, label %bb18, label %bb19
43 bb3: ; preds = %bb19, %bb12
44 %var4 = phi i32 [ %var15, %bb12 ], [ 0, %bb19 ]
45 %var5 = sub nsw i32 %var1, %var4
46 %var6 = icmp ult i32 %var5, %var
47 br i1 %var6, label %bb8, label %bb7
53 %var9 = load atomic i32, ptr addrspace(1) poison unordered, align 8, !range !0, !invariant.load !1, !noundef !1
54 %var10 = icmp ult i32 %var4, %var9
55 br i1 %var10, label %bb12, label %bb11
61 %var13 = zext i32 %var4 to i64
62 %var14 = getelementptr inbounds i32, ptr addrspace(1) poison, i64 %var13
63 %var15 = add nuw nsw i32 %var4, 1
64 %var16 = icmp ult i32 %var15, %var
65 br i1 %var16, label %bb3, label %bb17
77 !0 = !{i32 0, i32 2147483646}