xref: /llvm-project/polly/test/CodeGen/OpenMP/reference-preceeding-loop.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1*e1f056f6Srahulana-quic; RUN: opt %loadNPMPolly -polly-parallel -polly-parallel-force '-passes=print<polly-ast>' -disable-output < %s | FileCheck %s -check-prefix=AST
2*e1f056f6Srahulana-quic; RUN: opt %loadNPMPolly -polly-parallel -polly-parallel-force -passes=polly-codegen -S -verify-dom-info < %s | FileCheck %s -check-prefix=IR
335f70200SMichael Kruse
435f70200SMichael Kruse
535f70200SMichael Kruse; - Test the case where scalar evolution references a loop that is outside
635f70200SMichael Kruse;   of the scop, but does not contain the scop.
735f70200SMichael Kruse
835f70200SMichael Kruse; AST:         {
935f70200SMichael Kruse; AST-NEXT:    #pragma simd
1035f70200SMichael Kruse; AST-NEXT:    #pragma omp parallel for
1135f70200SMichael Kruse; AST-NEXT:    for (int c0 = 0; c0 < -p_0 + symbol; c0 += 1)
1235f70200SMichael Kruse; AST-NEXT:      Stmt_while_body(c0);
1335f70200SMichael Kruse; AST-NEXT:    if (p_0 >= symbol)
1435f70200SMichael Kruse; AST-NEXT:      Stmt_while_body(0);
1535f70200SMichael Kruse; AST-NEXT:    }
1635f70200SMichael Kruse
1735f70200SMichael Kruse; IR: @update_model_polly_subfn
1835f70200SMichael Kruse; IR-NOT: @update_model_polly_subfn_1
1935f70200SMichael Kruse
2035f70200SMichael Krusetarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
2135f70200SMichael Kruse
2235f70200SMichael Kruse@cum_freq = external global [258 x i64], align 16
2335f70200SMichael Kruse
2435f70200SMichael Krusedefine void @update_model(i64 %symbol) {
2535f70200SMichael Kruseentry:
2635f70200SMichael Kruse  br label %for.one
2735f70200SMichael Kruse
2835f70200SMichael Krusefor.one:
2935f70200SMichael Kruse  %i.1 = phi i64 [ %dec07, %for.one ], [ %symbol, %entry ]
3035f70200SMichael Kruse  %dec07 = add nsw i64 %i.1, -1
3135f70200SMichael Kruse  br i1 undef, label %for.one, label %while.body
3235f70200SMichael Kruse
3335f70200SMichael Krusewhile.body:
3435f70200SMichael Kruse  %indvar = phi i64 [ %sub42, %while.body ], [ %i.1, %for.one ]
3535f70200SMichael Kruse  %sub42 = add nsw i64 %indvar, -1
36b332499aSNikita Popov  %arrayidx44 = getelementptr inbounds [258 x i64], ptr @cum_freq, i64 0, i64 %sub42
37b332499aSNikita Popov  store i64 1, ptr %arrayidx44, align 4
3835f70200SMichael Kruse  %cmp40 = icmp sgt i64 %sub42, 0
3935f70200SMichael Kruse  br i1 %cmp40, label %while.body, label %while.end
4035f70200SMichael Kruse
4135f70200SMichael Krusewhile.end:
4235f70200SMichael Kruse  ret void
4335f70200SMichael Kruse}
44