1a2223612SMichael Kruse // Check code generation 2*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -verify -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=51 -emit-llvm %s -o - | FileCheck %s --check-prefix=IR 3a2223612SMichael Kruse 4a2223612SMichael Kruse // Check same results after serialization round-trip 5*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -verify -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=51 -emit-pch -o %t %s 6*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -verify -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=51 -include-pch %t -emit-llvm %s -o - | FileCheck %s --check-prefix=IR 7a2223612SMichael Kruse // expected-no-diagnostics 8a2223612SMichael Kruse 9a2223612SMichael Kruse #ifndef HEADER 10a2223612SMichael Kruse #define HEADER 11a2223612SMichael Kruse 12a2223612SMichael Kruse // placeholder for loop body code. 13a2223612SMichael Kruse extern "C" void body(...) {} 14a2223612SMichael Kruse 15a2223612SMichael Kruse 16a2223612SMichael Kruse // IR-LABEL: @func( 17a2223612SMichael Kruse // IR-NEXT: [[ENTRY:.*]]: 18a2223612SMichael Kruse // IR-NEXT: %[[START_ADDR:.+]] = alloca i32, align 4 19a2223612SMichael Kruse // IR-NEXT: %[[END_ADDR:.+]] = alloca i32, align 4 20a2223612SMichael Kruse // IR-NEXT: %[[STEP_ADDR:.+]] = alloca i32, align 4 21a2223612SMichael Kruse // IR-NEXT: %[[DOTOMP_IV:.+]] = alloca i32, align 4 22a2223612SMichael Kruse // IR-NEXT: %[[TMP:.+]] = alloca i32, align 4 23a2223612SMichael Kruse // IR-NEXT: %[[I:.+]] = alloca i32, align 4 24a2223612SMichael Kruse // IR-NEXT: %[[DOTCAPTURE_EXPR_:.+]] = alloca i32, align 4 25a2223612SMichael Kruse // IR-NEXT: %[[DOTCAPTURE_EXPR_1:.+]] = alloca i32, align 4 26a2223612SMichael Kruse // IR-NEXT: %[[DOTCAPTURE_EXPR_2:.+]] = alloca i32, align 4 27a2223612SMichael Kruse // IR-NEXT: %[[DOTCAPTURE_EXPR_3:.+]] = alloca i32, align 4 28a2223612SMichael Kruse // IR-NEXT: %[[DOTUNROLLED_IV_I:.+]] = alloca i32, align 4 29a2223612SMichael Kruse // IR-NEXT: %[[DOTCAPTURE_EXPR_6:.+]] = alloca i32, align 4 30a2223612SMichael Kruse // IR-NEXT: %[[DOTCAPTURE_EXPR_8:.+]] = alloca i32, align 4 31a2223612SMichael Kruse // IR-NEXT: %[[DOTCAPTURE_EXPR_12:.+]] = alloca i32, align 4 32a2223612SMichael Kruse // IR-NEXT: %[[DOTCAPTURE_EXPR_14:.+]] = alloca i32, align 4 33a2223612SMichael Kruse // IR-NEXT: %[[DOTFLOOR_0_IV__UNROLLED_IV_I:.+]] = alloca i32, align 4 34a2223612SMichael Kruse // IR-NEXT: %[[DOTOMP_LB:.+]] = alloca i32, align 4 35a2223612SMichael Kruse // IR-NEXT: %[[DOTOMP_UB:.+]] = alloca i32, align 4 36a2223612SMichael Kruse // IR-NEXT: %[[DOTOMP_STRIDE:.+]] = alloca i32, align 4 37a2223612SMichael Kruse // IR-NEXT: %[[DOTOMP_IS_LAST:.+]] = alloca i32, align 4 38a2223612SMichael Kruse // IR-NEXT: %[[DOTFLOOR_0_IV__UNROLLED_IV_I18:.+]] = alloca i32, align 4 39a2223612SMichael Kruse // IR-NEXT: %[[DOTTILE_0_IV__UNROLLED_IV_I:.+]] = alloca i32, align 4 40a2223612SMichael Kruse // IR-NEXT: %[[DOTUNROLL_INNER_IV_I:.+]] = alloca i32, align 4 41a2223612SMichael Kruse // IR-NEXT: %[[TMP0:.+]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @2) 42a2223612SMichael Kruse // IR-NEXT: store i32 %[[START:.+]], i32* %[[START_ADDR]], align 4 43a2223612SMichael Kruse // IR-NEXT: store i32 %[[END:.+]], i32* %[[END_ADDR]], align 4 44a2223612SMichael Kruse // IR-NEXT: store i32 %[[STEP:.+]], i32* %[[STEP_ADDR]], align 4 45a2223612SMichael Kruse // IR-NEXT: %[[TMP1:.+]] = load i32, i32* %[[START_ADDR]], align 4 46a2223612SMichael Kruse // IR-NEXT: store i32 %[[TMP1]], i32* %[[I]], align 4 47a2223612SMichael Kruse // IR-NEXT: %[[TMP2:.+]] = load i32, i32* %[[START_ADDR]], align 4 48a2223612SMichael Kruse // IR-NEXT: store i32 %[[TMP2]], i32* %[[DOTCAPTURE_EXPR_]], align 4 49a2223612SMichael Kruse // IR-NEXT: %[[TMP3:.+]] = load i32, i32* %[[END_ADDR]], align 4 50a2223612SMichael Kruse // IR-NEXT: store i32 %[[TMP3]], i32* %[[DOTCAPTURE_EXPR_1]], align 4 51a2223612SMichael Kruse // IR-NEXT: %[[TMP4:.+]] = load i32, i32* %[[STEP_ADDR]], align 4 52a2223612SMichael Kruse // IR-NEXT: store i32 %[[TMP4]], i32* %[[DOTCAPTURE_EXPR_2]], align 4 53a2223612SMichael Kruse // IR-NEXT: %[[TMP5:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_1]], align 4 54a2223612SMichael Kruse // IR-NEXT: %[[TMP6:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_]], align 4 55a2223612SMichael Kruse // IR-NEXT: %[[SUB:.+]] = sub i32 %[[TMP5]], %[[TMP6]] 56a2223612SMichael Kruse // IR-NEXT: %[[SUB4:.+]] = sub i32 %[[SUB]], 1 57a2223612SMichael Kruse // IR-NEXT: %[[TMP7:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_2]], align 4 58a2223612SMichael Kruse // IR-NEXT: %[[ADD:.+]] = add i32 %[[SUB4]], %[[TMP7]] 59a2223612SMichael Kruse // IR-NEXT: %[[TMP8:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_2]], align 4 60a2223612SMichael Kruse // IR-NEXT: %[[DIV:.+]] = udiv i32 %[[ADD]], %[[TMP8]] 61a2223612SMichael Kruse // IR-NEXT: %[[SUB5:.+]] = sub i32 %[[DIV]], 1 62a2223612SMichael Kruse // IR-NEXT: store i32 %[[SUB5]], i32* %[[DOTCAPTURE_EXPR_3]], align 4 63a2223612SMichael Kruse // IR-NEXT: store i32 0, i32* %[[DOTUNROLLED_IV_I]], align 4 64a2223612SMichael Kruse // IR-NEXT: %[[TMP9:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_3]], align 4 65a2223612SMichael Kruse // IR-NEXT: %[[ADD7:.+]] = add i32 %[[TMP9]], 1 66a2223612SMichael Kruse // IR-NEXT: store i32 %[[ADD7]], i32* %[[DOTCAPTURE_EXPR_6]], align 4 67a2223612SMichael Kruse // IR-NEXT: %[[TMP10:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_6]], align 4 68a2223612SMichael Kruse // IR-NEXT: %[[SUB9:.+]] = sub i32 %[[TMP10]], -1 69a2223612SMichael Kruse // IR-NEXT: %[[DIV10:.+]] = udiv i32 %[[SUB9]], 2 70a2223612SMichael Kruse // IR-NEXT: %[[SUB11:.+]] = sub i32 %[[DIV10]], 1 71a2223612SMichael Kruse // IR-NEXT: store i32 %[[SUB11]], i32* %[[DOTCAPTURE_EXPR_8]], align 4 72a2223612SMichael Kruse // IR-NEXT: %[[TMP11:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_8]], align 4 73a2223612SMichael Kruse // IR-NEXT: %[[ADD13:.+]] = add i32 %[[TMP11]], 1 74a2223612SMichael Kruse // IR-NEXT: store i32 %[[ADD13]], i32* %[[DOTCAPTURE_EXPR_12]], align 4 75a2223612SMichael Kruse // IR-NEXT: %[[TMP12:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_12]], align 4 76a2223612SMichael Kruse // IR-NEXT: %[[SUB15:.+]] = sub i32 %[[TMP12]], -3 77a2223612SMichael Kruse // IR-NEXT: %[[DIV16:.+]] = udiv i32 %[[SUB15]], 4 78a2223612SMichael Kruse // IR-NEXT: %[[SUB17:.+]] = sub i32 %[[DIV16]], 1 79a2223612SMichael Kruse // IR-NEXT: store i32 %[[SUB17]], i32* %[[DOTCAPTURE_EXPR_14]], align 4 80a2223612SMichael Kruse // IR-NEXT: store i32 0, i32* %[[DOTFLOOR_0_IV__UNROLLED_IV_I]], align 4 81a2223612SMichael Kruse // IR-NEXT: %[[TMP13:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_12]], align 4 82a2223612SMichael Kruse // IR-NEXT: %[[CMP:.+]] = icmp ult i32 0, %[[TMP13]] 83a2223612SMichael Kruse // IR-NEXT: br i1 %[[CMP]], label %[[OMP_PRECOND_THEN:.+]], label %[[OMP_PRECOND_END:.+]] 84a2223612SMichael Kruse // IR-EMPTY: 85a2223612SMichael Kruse // IR-NEXT: [[OMP_PRECOND_THEN]]: 86a2223612SMichael Kruse // IR-NEXT: store i32 0, i32* %[[DOTOMP_LB]], align 4 87a2223612SMichael Kruse // IR-NEXT: %[[TMP14:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_14]], align 4 88a2223612SMichael Kruse // IR-NEXT: store i32 %[[TMP14]], i32* %[[DOTOMP_UB]], align 4 89a2223612SMichael Kruse // IR-NEXT: store i32 1, i32* %[[DOTOMP_STRIDE]], align 4 90a2223612SMichael Kruse // IR-NEXT: store i32 0, i32* %[[DOTOMP_IS_LAST]], align 4 91a2223612SMichael Kruse // IR-NEXT: call void @__kmpc_for_static_init_4u(%struct.ident_t* @1, i32 %[[TMP0]], i32 34, i32* %[[DOTOMP_IS_LAST]], i32* %[[DOTOMP_LB]], i32* %[[DOTOMP_UB]], i32* %[[DOTOMP_STRIDE]], i32 1, i32 1) 92a2223612SMichael Kruse // IR-NEXT: %[[TMP15:.+]] = load i32, i32* %[[DOTOMP_UB]], align 4 93a2223612SMichael Kruse // IR-NEXT: %[[TMP16:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_14]], align 4 94a2223612SMichael Kruse // IR-NEXT: %[[CMP19:.+]] = icmp ugt i32 %[[TMP15]], %[[TMP16]] 95a2223612SMichael Kruse // IR-NEXT: br i1 %[[CMP19]], label %[[COND_TRUE:.+]], label %[[COND_FALSE:.+]] 96a2223612SMichael Kruse // IR-EMPTY: 97a2223612SMichael Kruse // IR-NEXT: [[COND_TRUE]]: 98a2223612SMichael Kruse // IR-NEXT: %[[TMP17:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_14]], align 4 99a2223612SMichael Kruse // IR-NEXT: br label %[[COND_END:.+]] 100a2223612SMichael Kruse // IR-EMPTY: 101a2223612SMichael Kruse // IR-NEXT: [[COND_FALSE]]: 102a2223612SMichael Kruse // IR-NEXT: %[[TMP18:.+]] = load i32, i32* %[[DOTOMP_UB]], align 4 103a2223612SMichael Kruse // IR-NEXT: br label %[[COND_END]] 104a2223612SMichael Kruse // IR-EMPTY: 105a2223612SMichael Kruse // IR-NEXT: [[COND_END]]: 106a2223612SMichael Kruse // IR-NEXT: %[[COND:.+]] = phi i32 [ %[[TMP17]], %[[COND_TRUE]] ], [ %[[TMP18]], %[[COND_FALSE]] ] 107a2223612SMichael Kruse // IR-NEXT: store i32 %[[COND]], i32* %[[DOTOMP_UB]], align 4 108a2223612SMichael Kruse // IR-NEXT: %[[TMP19:.+]] = load i32, i32* %[[DOTOMP_LB]], align 4 109a2223612SMichael Kruse // IR-NEXT: store i32 %[[TMP19]], i32* %[[DOTOMP_IV]], align 4 110a2223612SMichael Kruse // IR-NEXT: br label %[[OMP_INNER_FOR_COND:.+]] 111a2223612SMichael Kruse // IR-EMPTY: 112a2223612SMichael Kruse // IR-NEXT: [[OMP_INNER_FOR_COND]]: 113a2223612SMichael Kruse // IR-NEXT: %[[TMP20:.+]] = load i32, i32* %[[DOTOMP_IV]], align 4 114a2223612SMichael Kruse // IR-NEXT: %[[TMP21:.+]] = load i32, i32* %[[DOTOMP_UB]], align 4 115a2223612SMichael Kruse // IR-NEXT: %[[ADD20:.+]] = add i32 %[[TMP21]], 1 116a2223612SMichael Kruse // IR-NEXT: %[[CMP21:.+]] = icmp ult i32 %[[TMP20]], %[[ADD20]] 117a2223612SMichael Kruse // IR-NEXT: br i1 %[[CMP21]], label %[[OMP_INNER_FOR_BODY:.+]], label %[[OMP_INNER_FOR_END:.+]] 118a2223612SMichael Kruse // IR-EMPTY: 119a2223612SMichael Kruse // IR-NEXT: [[OMP_INNER_FOR_BODY]]: 120a2223612SMichael Kruse // IR-NEXT: %[[TMP22:.+]] = load i32, i32* %[[DOTOMP_IV]], align 4 121a2223612SMichael Kruse // IR-NEXT: %[[MUL:.+]] = mul i32 %[[TMP22]], 4 122a2223612SMichael Kruse // IR-NEXT: %[[ADD22:.+]] = add i32 0, %[[MUL]] 123a2223612SMichael Kruse // IR-NEXT: store i32 %[[ADD22]], i32* %[[DOTFLOOR_0_IV__UNROLLED_IV_I18]], align 4 124a2223612SMichael Kruse // IR-NEXT: %[[TMP23:.+]] = load i32, i32* %[[DOTFLOOR_0_IV__UNROLLED_IV_I18]], align 4 125a2223612SMichael Kruse // IR-NEXT: store i32 %[[TMP23]], i32* %[[DOTTILE_0_IV__UNROLLED_IV_I]], align 4 126a2223612SMichael Kruse // IR-NEXT: br label %[[FOR_COND:.+]] 127a2223612SMichael Kruse // IR-EMPTY: 128a2223612SMichael Kruse // IR-NEXT: [[FOR_COND]]: 129a2223612SMichael Kruse // IR-NEXT: %[[TMP24:.+]] = load i32, i32* %[[DOTTILE_0_IV__UNROLLED_IV_I]], align 4 130a2223612SMichael Kruse // IR-NEXT: %[[TMP25:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_8]], align 4 131a2223612SMichael Kruse // IR-NEXT: %[[ADD23:.+]] = add i32 %[[TMP25]], 1 132a2223612SMichael Kruse // IR-NEXT: %[[TMP26:.+]] = load i32, i32* %[[DOTFLOOR_0_IV__UNROLLED_IV_I18]], align 4 133a2223612SMichael Kruse // IR-NEXT: %[[ADD24:.+]] = add i32 %[[TMP26]], 4 134a2223612SMichael Kruse // IR-NEXT: %[[CMP25:.+]] = icmp ult i32 %[[ADD23]], %[[ADD24]] 135a2223612SMichael Kruse // IR-NEXT: br i1 %[[CMP25]], label %[[COND_TRUE26:.+]], label %[[COND_FALSE28:.+]] 136a2223612SMichael Kruse // IR-EMPTY: 137a2223612SMichael Kruse // IR-NEXT: [[COND_TRUE26]]: 138a2223612SMichael Kruse // IR-NEXT: %[[TMP27:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_8]], align 4 139a2223612SMichael Kruse // IR-NEXT: %[[ADD27:.+]] = add i32 %[[TMP27]], 1 140a2223612SMichael Kruse // IR-NEXT: br label %[[COND_END30:.+]] 141a2223612SMichael Kruse // IR-EMPTY: 142a2223612SMichael Kruse // IR-NEXT: [[COND_FALSE28]]: 143a2223612SMichael Kruse // IR-NEXT: %[[TMP28:.+]] = load i32, i32* %[[DOTFLOOR_0_IV__UNROLLED_IV_I18]], align 4 144a2223612SMichael Kruse // IR-NEXT: %[[ADD29:.+]] = add i32 %[[TMP28]], 4 145a2223612SMichael Kruse // IR-NEXT: br label %[[COND_END30]] 146a2223612SMichael Kruse // IR-EMPTY: 147a2223612SMichael Kruse // IR-NEXT: [[COND_END30]]: 148a2223612SMichael Kruse // IR-NEXT: %[[COND31:.+]] = phi i32 [ %[[ADD27]], %[[COND_TRUE26]] ], [ %[[ADD29]], %[[COND_FALSE28]] ] 149a2223612SMichael Kruse // IR-NEXT: %[[CMP32:.+]] = icmp ult i32 %[[TMP24]], %[[COND31]] 150a2223612SMichael Kruse // IR-NEXT: br i1 %[[CMP32]], label %[[FOR_BODY:.+]], label %[[FOR_END45:.+]] 151a2223612SMichael Kruse // IR-EMPTY: 152a2223612SMichael Kruse // IR-NEXT: [[FOR_BODY]]: 153a2223612SMichael Kruse // IR-NEXT: %[[TMP29:.+]] = load i32, i32* %[[DOTTILE_0_IV__UNROLLED_IV_I]], align 4 154a2223612SMichael Kruse // IR-NEXT: %[[MUL33:.+]] = mul i32 %[[TMP29]], 2 155a2223612SMichael Kruse // IR-NEXT: %[[ADD34:.+]] = add i32 0, %[[MUL33]] 156a2223612SMichael Kruse // IR-NEXT: store i32 %[[ADD34]], i32* %[[DOTUNROLLED_IV_I]], align 4 157a2223612SMichael Kruse // IR-NEXT: %[[TMP30:.+]] = load i32, i32* %[[DOTUNROLLED_IV_I]], align 4 158a2223612SMichael Kruse // IR-NEXT: store i32 %[[TMP30]], i32* %[[DOTUNROLL_INNER_IV_I]], align 4 159a2223612SMichael Kruse // IR-NEXT: br label %[[FOR_COND35:.+]] 160a2223612SMichael Kruse // IR-EMPTY: 161a2223612SMichael Kruse // IR-NEXT: [[FOR_COND35]]: 162a2223612SMichael Kruse // IR-NEXT: %[[TMP31:.+]] = load i32, i32* %[[DOTUNROLL_INNER_IV_I]], align 4 163a2223612SMichael Kruse // IR-NEXT: %[[TMP32:.+]] = load i32, i32* %[[DOTUNROLLED_IV_I]], align 4 164a2223612SMichael Kruse // IR-NEXT: %[[ADD36:.+]] = add i32 %[[TMP32]], 2 165a2223612SMichael Kruse // IR-NEXT: %[[CMP37:.+]] = icmp ule i32 %[[TMP31]], %[[ADD36]] 166a2223612SMichael Kruse // IR-NEXT: br i1 %[[CMP37]], label %[[LAND_RHS:.+]], label %[[LAND_END:.+]] 167a2223612SMichael Kruse // IR-EMPTY: 168a2223612SMichael Kruse // IR-NEXT: [[LAND_RHS]]: 169a2223612SMichael Kruse // IR-NEXT: %[[TMP33:.+]] = load i32, i32* %[[DOTUNROLL_INNER_IV_I]], align 4 170a2223612SMichael Kruse // IR-NEXT: %[[TMP34:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_3]], align 4 171a2223612SMichael Kruse // IR-NEXT: %[[ADD38:.+]] = add i32 %[[TMP34]], 1 172a2223612SMichael Kruse // IR-NEXT: %[[CMP39:.+]] = icmp ule i32 %[[TMP33]], %[[ADD38]] 173a2223612SMichael Kruse // IR-NEXT: br label %[[LAND_END]] 174a2223612SMichael Kruse // IR-EMPTY: 175a2223612SMichael Kruse // IR-NEXT: [[LAND_END]]: 176a2223612SMichael Kruse // IR-NEXT: %[[TMP35:.+]] = phi i1 [ false, %[[FOR_COND35]] ], [ %[[CMP39]], %[[LAND_RHS]] ] 177a2223612SMichael Kruse // IR-NEXT: br i1 %[[TMP35]], label %[[FOR_BODY40:.+]], label %[[FOR_END:.+]] 178a2223612SMichael Kruse // IR-EMPTY: 179a2223612SMichael Kruse // IR-NEXT: [[FOR_BODY40]]: 180a2223612SMichael Kruse // IR-NEXT: %[[TMP36:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_]], align 4 181a2223612SMichael Kruse // IR-NEXT: %[[TMP37:.+]] = load i32, i32* %[[DOTUNROLL_INNER_IV_I]], align 4 182a2223612SMichael Kruse // IR-NEXT: %[[TMP38:.+]] = load i32, i32* %[[DOTCAPTURE_EXPR_2]], align 4 183a2223612SMichael Kruse // IR-NEXT: %[[MUL41:.+]] = mul i32 %[[TMP37]], %[[TMP38]] 184a2223612SMichael Kruse // IR-NEXT: %[[ADD42:.+]] = add i32 %[[TMP36]], %[[MUL41]] 185a2223612SMichael Kruse // IR-NEXT: store i32 %[[ADD42]], i32* %[[I]], align 4 186a2223612SMichael Kruse // IR-NEXT: %[[TMP39:.+]] = load i32, i32* %[[START_ADDR]], align 4 187a2223612SMichael Kruse // IR-NEXT: %[[TMP40:.+]] = load i32, i32* %[[END_ADDR]], align 4 188a2223612SMichael Kruse // IR-NEXT: %[[TMP41:.+]] = load i32, i32* %[[STEP_ADDR]], align 4 189a2223612SMichael Kruse // IR-NEXT: %[[TMP42:.+]] = load i32, i32* %[[I]], align 4 1901b1c8d83Shyeongyu kim // IR-NEXT: call void (...) @body(i32 noundef %[[TMP39]], i32 noundef %[[TMP40]], i32 noundef %[[TMP41]], i32 noundef %[[TMP42]]) 191a2223612SMichael Kruse // IR-NEXT: br label %[[FOR_INC:.+]] 192a2223612SMichael Kruse // IR-EMPTY: 193a2223612SMichael Kruse // IR-NEXT: [[FOR_INC]]: 194a2223612SMichael Kruse // IR-NEXT: %[[TMP43:.+]] = load i32, i32* %[[DOTUNROLL_INNER_IV_I]], align 4 195a2223612SMichael Kruse // IR-NEXT: %[[INC:.+]] = add i32 %[[TMP43]], 1 196a2223612SMichael Kruse // IR-NEXT: store i32 %[[INC]], i32* %[[DOTUNROLL_INNER_IV_I]], align 4 197a2223612SMichael Kruse // IR-NEXT: br label %[[FOR_COND35]], !llvm.loop ![[LOOP2:[0-9]+]] 198a2223612SMichael Kruse // IR-EMPTY: 199a2223612SMichael Kruse // IR-NEXT: [[FOR_END]]: 200a2223612SMichael Kruse // IR-NEXT: br label %[[FOR_INC43:.+]] 201a2223612SMichael Kruse // IR-EMPTY: 202a2223612SMichael Kruse // IR-NEXT: [[FOR_INC43]]: 203a2223612SMichael Kruse // IR-NEXT: %[[TMP44:.+]] = load i32, i32* %[[DOTTILE_0_IV__UNROLLED_IV_I]], align 4 204a2223612SMichael Kruse // IR-NEXT: %[[INC44:.+]] = add i32 %[[TMP44]], 1 205a2223612SMichael Kruse // IR-NEXT: store i32 %[[INC44]], i32* %[[DOTTILE_0_IV__UNROLLED_IV_I]], align 4 206a2223612SMichael Kruse // IR-NEXT: br label %[[FOR_COND]], !llvm.loop ![[LOOP5:[0-9]+]] 207a2223612SMichael Kruse // IR-EMPTY: 208a2223612SMichael Kruse // IR-NEXT: [[FOR_END45]]: 209a2223612SMichael Kruse // IR-NEXT: br label %[[OMP_BODY_CONTINUE:.+]] 210a2223612SMichael Kruse // IR-EMPTY: 211a2223612SMichael Kruse // IR-NEXT: [[OMP_BODY_CONTINUE]]: 212a2223612SMichael Kruse // IR-NEXT: br label %[[OMP_INNER_FOR_INC:.+]] 213a2223612SMichael Kruse // IR-EMPTY: 214a2223612SMichael Kruse // IR-NEXT: [[OMP_INNER_FOR_INC]]: 215a2223612SMichael Kruse // IR-NEXT: %[[TMP45:.+]] = load i32, i32* %[[DOTOMP_IV]], align 4 216a2223612SMichael Kruse // IR-NEXT: %[[ADD46:.+]] = add i32 %[[TMP45]], 1 217a2223612SMichael Kruse // IR-NEXT: store i32 %[[ADD46]], i32* %[[DOTOMP_IV]], align 4 218a2223612SMichael Kruse // IR-NEXT: br label %[[OMP_INNER_FOR_COND]] 219a2223612SMichael Kruse // IR-EMPTY: 220a2223612SMichael Kruse // IR-NEXT: [[OMP_INNER_FOR_END]]: 221a2223612SMichael Kruse // IR-NEXT: br label %[[OMP_LOOP_EXIT:.+]] 222a2223612SMichael Kruse // IR-EMPTY: 223a2223612SMichael Kruse // IR-NEXT: [[OMP_LOOP_EXIT]]: 224a2223612SMichael Kruse // IR-NEXT: call void @__kmpc_for_static_fini(%struct.ident_t* @1, i32 %[[TMP0]]) 225a2223612SMichael Kruse // IR-NEXT: br label %[[OMP_PRECOND_END]] 226a2223612SMichael Kruse // IR-EMPTY: 227a2223612SMichael Kruse // IR-NEXT: [[OMP_PRECOND_END]]: 228a2223612SMichael Kruse // IR-NEXT: call void @__kmpc_barrier(%struct.ident_t* @3, i32 %[[TMP0]]) 229a2223612SMichael Kruse // IR-NEXT: ret void 230a2223612SMichael Kruse // IR-NEXT: } 231a2223612SMichael Kruse extern "C" void func(int start, int end, int step) { 232a2223612SMichael Kruse #pragma omp for 233a2223612SMichael Kruse #pragma omp tile sizes(4) 234a2223612SMichael Kruse #pragma omp unroll partial 235a2223612SMichael Kruse for (int i = start; i < end; i+=step) 236a2223612SMichael Kruse body(start, end, step, i); 237a2223612SMichael Kruse } 238a2223612SMichael Kruse 239a2223612SMichael Kruse #endif /* HEADER */ 240a2223612SMichael Kruse 241a2223612SMichael Kruse 242a2223612SMichael Kruse // IR: ![[LOOP2]] = distinct !{![[LOOP2]], ![[LOOPPROP3:[0-9]+]], ![[LOOPPROP4:[0-9]+]]} 243a2223612SMichael Kruse // IR: ![[LOOPPROP3]] = !{!"llvm.loop.mustprogress"} 244a2223612SMichael Kruse // IR: ![[LOOPPROP4]] = !{!"llvm.loop.unroll.count", i32 2} 245a2223612SMichael Kruse // IR: ![[LOOP5]] = distinct !{![[LOOP5]], ![[LOOPPROP3]]} 246