1 // RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
4 // CHECK: @a = global [1 x i32] zeroinitializer
6 void test_transform() {
9 void (*d
)(){test_transform
<0>};
10 // CHECK-LABEL: define {{.*}} @_Z14test_transformILi0EEvv
11 // CHECK: [[ENTRY:.*]]:
12 // CHECK-NEXT: [[ARR:%.*]] = alloca [1 x i32]
13 // CHECK-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [1 x i32], ptr [[ARR]], i64 0, i64 0
14 // CHECK-NEXT: br label %[[BODY:.*]]
16 // CHECK-NEXT: [[BODY]]:
17 // CHECK-NEXT: [[CUR:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[NEXT:%.*]], %[[BODY]] ]
18 // CHECK-NEXT: [[DEST:%.*]] = getelementptr inbounds i32, ptr [[BEGIN]], i64 [[CUR]]
19 // CHECK-NEXT: [[SRC:%.*]] = getelementptr inbounds [1 x i32], ptr @a, i64 0, i64 [[CUR]]
20 // CHECK-NEXT: [[X:%.*]] = load i32, ptr [[SRC]]
21 // CHECK-NEXT: store i32 [[X]], ptr [[DEST]]
22 // CHECK-NEXT: [[NEXT]] = add nuw i64 [[CUR]], 1
23 // CHECK-NEXT: [[EQ:%.*]] = icmp eq i64 [[NEXT]], 1
24 // CHECK-NEXT: br i1 [[EQ]], label %[[FIN:.*]], label %[[BODY]]
26 // CHECK-NEXT: [[FIN]]:
27 // CHECK-NEXT: ret void