1 ; RUN: opt %loadPolly -polly-print-scops -polly-detect-keep-going -polly-allow-nonaffine -disable-output < %s | FileCheck %s
5 ; %idxprom = sext i32 %call to i64
7 ; uses an argument that is inside and error block. Since error blocks are
8 ; removed from the SCoP, the argument is not available. Polly currently
9 ; does not consider that %idxprom itself is an error block as well.
11 ; This also tests that -polly-detect-keep-going still correctly rejects this SCoP.
12 ; https://llvm.org/PR58484
14 ; CHECK: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'for.cond => for.end' in function 'g':
15 ; CHECK-NEXT: Invalid Scop!
18 ; void g(int *A, int N) {
19 ; for (int i = 0; i < N; i++) {
29 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
31 define void @g(ptr %A, i32 %N) {
33 %tmp = sext i32 %N to i64
36 for.cond: ; preds = %for.inc, %entry
37 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
38 %cmp = icmp slt i64 %indvars.iv, %tmp
39 br i1 %cmp, label %for.body, label %for.end
41 for.body: ; preds = %for.cond
42 %cmp1 = icmp sgt i64 %indvars.iv, 512
43 br i1 %cmp1, label %if.then, label %if.end3
45 if.then: ; preds = %for.body
46 %call = call i32 (...) @f()
50 %idxprom = sext i32 %call to i64
51 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
52 %tmp1 = load i32, ptr %arrayidx, align 4
53 %inc = add nsw i32 %tmp1, 1
54 store i32 %inc, ptr %arrayidx, align 4
57 if.end3: ; preds = %if.end, %for.body
58 %arrayidx5 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
59 %tmp2 = load i32, ptr %arrayidx5, align 4
60 %inc6 = add nsw i32 %tmp2, 1
61 store i32 %inc6, ptr %arrayidx5, align 4
64 for.inc: ; preds = %if.end3, %if.then2
65 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
68 for.end: ; preds = %for.cond