1 // Check code generation
2 // RUN: %clang_cc1 -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s --check-prefix=IR
4 // Check same results after serialization round-trip
5 // RUN: %clang_cc1 -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-pch -o %t %s
6 // RUN: %clang_cc1 -verify -triple x86_64-pc-linux-gnu -fopenmp -include-pch %t -emit-llvm %s -o - | FileCheck %s --check-prefix=IR
7 // expected-no-diagnostics
12 // placeholder for loop body code.
13 extern "C" void body(...) {}
17 // IR-NEXT: [[ENTRY:.*]]:
18 // IR-NEXT: %[[I:.+]] = alloca i32, align 4
19 // IR-NEXT: store i32 7, ptr %[[I]], align 4
20 // IR-NEXT: br label %[[FOR_COND:.+]]
22 // IR-NEXT: [[FOR_COND]]:
23 // IR-NEXT: %[[TMP0:.+]] = load i32, ptr %[[I]], align 4
24 // IR-NEXT: %[[CMP:.+]] = icmp slt i32 %[[TMP0]], 17
25 // IR-NEXT: br i1 %[[CMP]], label %[[FOR_BODY:.+]], label %[[FOR_END:.+]]
27 // IR-NEXT: [[FOR_BODY]]:
28 // IR-NEXT: %[[TMP1:.+]] = load i32, ptr %[[I]], align 4
29 // IR-NEXT: call void (...) @body(i32 noundef %[[TMP1]])
30 // IR-NEXT: br label %[[FOR_INC:.+]]
32 // IR-NEXT: [[FOR_INC]]:
33 // IR-NEXT: %[[TMP2:.+]] = load i32, ptr %[[I]], align 4
34 // IR-NEXT: %[[ADD:.+]] = add nsw i32 %[[TMP2]], 3
35 // IR-NEXT: store i32 %[[ADD]], ptr %[[I]], align 4
36 // IR-NEXT: br label %[[FOR_COND]], !llvm.loop ![[LOOP2:[0-9]+]]
38 // IR-NEXT: [[FOR_END]]:
41 extern "C" void func() {
42 #pragma omp unroll full
43 for (int i
= 7; i
< 17; i
+= 3)
50 // IR: ![[LOOP2]] = distinct !{![[LOOP2]], ![[LOOPPROP3:[0-9]+]], ![[LOOPPROP4:[0-9]+]]}
51 // IR: ![[LOOPPROP3]] = !{!"llvm.loop.mustprogress"}
52 // IR: ![[LOOPPROP4]] = !{!"llvm.loop.unroll.full"}