[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / polly / test / CodeGen / OpenMP / loop-body-references-outer-values-3.ll
blob0f025bb9411295d96fa9ad1cdd43455fe8685294
1 ; RUN: opt %loadPolly -basic-aa -polly-parallel -polly-parallel-force -polly-invariant-load-hoisting=true -polly-print-ast -disable-output < %s | FileCheck %s -check-prefix=AST
2 ; RUN: opt %loadPolly -basic-aa -polly-parallel -polly-parallel-force -polly-invariant-load-hoisting=true -polly-codegen -S -verify-dom-info < %s | FileCheck %s -check-prefix=IR
4 ; The interesting part of this test case is the instruction:
5 ;   %tmp = bitcast i8* %call to i64**
6 ; which is not part of the scop. In the SCEV based code generation not '%tmp',
7 ; but %call is a parameter of the SCoP and we need to make sure its value is
8 ; properly forwarded to the subfunction.
10 ; AST: #pragma omp parallel for
11 ; AST: for (int c0 = 0; c0 < cols; c0 += 1)
12 ; AST:   Stmt_for_body(c0);
13 ; AST: if (cols <= 0)
14 ; AST:   Stmt_for_body(0);
16 ; IR: @foo_polly_subfn
18 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
20 define void @foo(i64 %cols, ptr noalias %call) {
21 entry:
22   br label %for.body
24 for.body:
25   %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
26   %tmp1 = load ptr, ptr %call, align 8
27   %arrayidx.2 = getelementptr inbounds i64, ptr %tmp1, i64 %indvar
28   store i64 1, ptr %arrayidx.2, align 4
29   %indvar.next = add nsw i64 %indvar, 1
30   %cmp = icmp slt i64 %indvar.next, %cols
31   br i1 %cmp, label %for.body, label %end
33 end:
34   ret void
37 ; Another variation of this test case, now with even more of the index
38 ; expression defined outside of the scop.
40 ; AST: #pragma omp parallel for
41 ; AST: for (int c0 = 0; c0 < cols; c0 += 1)
42 ; AST:   Stmt_for_body(c0);
43 ; AST: if (cols <= 0)
44 ; AST:   Stmt_for_body(0);
46 ; IR: @bar_polly_subfn
48 define void @bar(i64 %cols, ptr noalias %call) {
49 entry:
50   br label %for.body
52 for.body:
53   %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
54   %tmp1 = load ptr, ptr %call, align 8
55   %arrayidx.2 = getelementptr inbounds i64, ptr %tmp1, i64 %indvar
56   store i64 1, ptr %arrayidx.2, align 4
57   %indvar.next = add nsw i64 %indvar, 1
58   %cmp = icmp slt i64 %indvar.next, %cols
59   br i1 %cmp, label %for.body, label %end
61 end:
62   ret void