1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
4 // CHECK-LABEL: @_Z1fv(
6 // CHECK-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
7 // CHECK-NEXT: [[I:%.*]] = alloca i32, align 4
8 // CHECK-NEXT: [[X:%.*]] = alloca i32, align 4
9 // CHECK-NEXT: store i32 0, i32* [[I]], align 4
10 // CHECK-NEXT: br label [[FOR_COND:%.*]]
12 // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I]], align 4
13 // CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[TMP0]], 2
14 // CHECK-NEXT: [[TMP1:%.*]] = zext i1 [[CMP]] to i64
15 // CHECK-NEXT: [[COND:%.*]] = select i1 [[CMP]], i32 1, i32 0
16 // CHECK-NEXT: store i32 [[COND]], i32* [[X]], align 4
17 // CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[X]], align 4
18 // CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[TMP2]], 0
19 // CHECK-NEXT: br i1 [[TOBOOL]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
21 // CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[X]], align 4
22 // CHECK-NEXT: store i32 [[TMP3]], i32* [[RETVAL]], align 4
23 // CHECK-NEXT: br label [[RETURN:%.*]]
25 // CHECK-NEXT: [[TMP4:%.*]] = load i32, i32* [[I]], align 4
26 // CHECK-NEXT: [[INC:%.*]] = add nsw i32 [[TMP4]], 1
27 // CHECK-NEXT: store i32 [[INC]], i32* [[I]], align 4
28 // CHECK-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP2:![0-9]+]]
30 // CHECK-NEXT: store i32 0, i32* [[RETVAL]], align 4
31 // CHECK-NEXT: br label [[RETURN]]
33 // CHECK-NEXT: [[TMP5:%.*]] = load i32, i32* [[RETVAL]], align 4
34 // CHECK-NEXT: ret i32 [[TMP5]]
37 for (int i
= 0; int x
= i
< 2 ? 1 : 0; i
++) {