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