1; RUN: opt %loadNPMPolly -polly-parallel -polly-parallel-force '-passes=print<polly-ast>' -disable-output < %s | FileCheck %s -check-prefix=AST 2; RUN: opt %loadNPMPolly -polly-parallel -polly-parallel-force -passes=polly-codegen -S < %s | FileCheck %s -check-prefix=IR 3 4; Make sure we correctly forward the reference to 'A' to the OpenMP subfunction. 5; 6; void loop_references_outer_ids(float *A) { 7; for (long i = 0; i < 100; i++) 8; A[i] = i; 9; } 10 11 12; AST: #pragma simd 13; AST: #pragma omp parallel for 14; AST: for (int c0 = 0; c0 <= 99; c0 += 1) 15; AST: Stmt_for_body(c0); 16 17; IR-LABEL: polly.parallel.for: 18; IR-NEXT: %polly.subfn.storeaddr.A = getelementptr inbounds nuw { ptr }, ptr %polly.par.userContext, i32 0, i32 0 19; IR-NEXT: store ptr %A, ptr %polly.subfn.storeaddr.A 20 21target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 22 23define void @loop_references_outer_ids(ptr %A) { 24entry: 25 br label %for.cond 26 27for.cond: ; preds = %for.inc, %entry 28 %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.inc ] 29 %exitcond = icmp ne i64 %i.0, 100 30 br i1 %exitcond, label %for.body, label %for.end 31 32for.body: ; preds = %for.cond 33 %conv = sitofp i64 %i.0 to float 34 %arrayidx = getelementptr inbounds float, ptr %A, i64 %i.0 35 store float %conv, ptr %arrayidx, align 4 36 br label %for.inc 37 38for.inc: ; preds = %for.body 39 %inc = add nsw i64 %i.0, 1 40 br label %for.cond 41 42for.end: ; preds = %for.cond 43 ret void 44} 45