1; RUN: opt %loadPolly -basic-aa -polly-parallel -polly-parallel-force -polly-invariant-load-hoisting=true -polly-ast -analyze < %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 3 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. 9 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); 15 16; IR: @foo_polly_subfn 17 18target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 19 20define void @foo(i64 %cols, i8* noalias %call) { 21entry: 22 %tmp = bitcast i8* %call to i64** 23 br label %for.body 24 25for.body: 26 %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ] 27 %arrayidx = getelementptr inbounds i64*, i64** %tmp, i64 0 28 %tmp1 = load i64*, i64** %arrayidx, align 8 29 %arrayidx.2 = getelementptr inbounds i64, i64* %tmp1, i64 %indvar 30 store i64 1, i64* %arrayidx.2, align 4 31 %indvar.next = add nsw i64 %indvar, 1 32 %cmp = icmp slt i64 %indvar.next, %cols 33 br i1 %cmp, label %for.body, label %end 34 35end: 36 ret void 37} 38 39; Another variation of this test case, now with even more of the index 40; expression defined outside of the scop. 41 42; AST: #pragma omp parallel for 43; AST: for (int c0 = 0; c0 < cols; c0 += 1) 44; AST: Stmt_for_body(c0); 45; AST: if (cols <= 0) 46; AST: Stmt_for_body(0); 47 48; IR: @bar_polly_subfn 49 50define void @bar(i64 %cols, i8* noalias %call) { 51entry: 52 %tmp = bitcast i8* %call to i64** 53 %arrayidx = getelementptr inbounds i64*, i64** %tmp, i64 0 54 br label %for.body 55 56for.body: 57 %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ] 58 %tmp1 = load i64*, i64** %arrayidx, align 8 59 %arrayidx.2 = getelementptr inbounds i64, i64* %tmp1, i64 %indvar 60 store i64 1, i64* %arrayidx.2, align 4 61 %indvar.next = add nsw i64 %indvar, 1 62 %cmp = icmp slt i64 %indvar.next, %cols 63 br i1 %cmp, label %for.body, label %end 64 65end: 66 ret void 67} 68