1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 2 // Check code generation 3 // RUN: %clang_cc1 -verify -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=51 -emit-llvm %s -o - | FileCheck %s --check-prefix=IR 4 5 // Check same results after serialization round-trip 6 // RUN: %clang_cc1 -verify -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=51 -emit-pch -o %t %s 7 // RUN: %clang_cc1 -verify -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=51 -include-pch %t -emit-llvm %s -o - | FileCheck %s --check-prefix=IR 8 // expected-no-diagnostics 9 10 #ifndef HEADER 11 #define HEADER 12 13 // placeholder for loop body code. 14 extern "C" void body(...) {} 15 16 17 // IR-LABEL: @func( 18 // IR-NEXT: entry: 19 // IR-NEXT: [[START_ADDR:%.*]] = alloca i32, align 4 20 // IR-NEXT: [[END_ADDR:%.*]] = alloca i32, align 4 21 // IR-NEXT: [[STEP_ADDR:%.*]] = alloca i32, align 4 22 // IR-NEXT: [[OMP_OUTLINED_ARG_AGG_:%.*]] = alloca [[STRUCT_ANON:%.*]], align 8 23 // IR-NEXT: store i32 [[START:%.*]], i32* [[START_ADDR]], align 4 24 // IR-NEXT: store i32 [[END:%.*]], i32* [[END_ADDR]], align 4 25 // IR-NEXT: store i32 [[STEP:%.*]], i32* [[STEP_ADDR]], align 4 26 // IR-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_ANON]], %struct.anon* [[OMP_OUTLINED_ARG_AGG_]], i32 0, i32 0 27 // IR-NEXT: store i32* [[END_ADDR]], i32** [[TMP0]], align 8 28 // IR-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_ANON]], %struct.anon* [[OMP_OUTLINED_ARG_AGG_]], i32 0, i32 1 29 // IR-NEXT: store i32* [[STEP_ADDR]], i32** [[TMP1]], align 8 30 // IR-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_ANON]], %struct.anon* [[OMP_OUTLINED_ARG_AGG_]], i32 0, i32 2 31 // IR-NEXT: store i32* [[START_ADDR]], i32** [[TMP2]], align 8 32 // IR-NEXT: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* @[[GLOB2:[0-9]+]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon*)* @.omp_outlined. to void (i32*, i32*, ...)*), %struct.anon* [[OMP_OUTLINED_ARG_AGG_]]) 33 // IR-NEXT: ret void 34 // 35 extern "C" void func(int start, int end, int step) { 36 #pragma omp parallel for 37 #pragma omp unroll partial(7) 38 for (int i = start; i < end; i+=step) 39 body(start, end, step, i); 40 } 41 42 43 44 #endif /* HEADER */ 45 46 47