1; RUN: opt %loadPolly -polly-print-scops -polly-detect-keep-going -polly-allow-nonaffine -disable-output < %s | FileCheck %s 2; 3; The instruction 4; 5; %idxprom = sext i32 %call to i64 6; 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. 10; 11; This also tests that -polly-detect-keep-going still correctly rejects this SCoP. 12; https://llvm.org/PR58484 13; 14; CHECK: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'for.cond => for.end' in function 'g': 15; CHECK-NEXT: Invalid Scop! 16; 17; int f(); 18; void g(int *A, int N) { 19; for (int i = 0; i < N; i++) { 20; if (i > 512) { 21; int v = f(); 22; S: 23; A[v]++; 24; } 25; A[i]++; 26; } 27; } 28; 29target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 30 31define void @g(ptr %A, i32 %N) { 32entry: 33 %tmp = sext i32 %N to i64 34 br label %for.cond 35 36for.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 40 41for.body: ; preds = %for.cond 42 %cmp1 = icmp sgt i64 %indvars.iv, 512 43 br i1 %cmp1, label %if.then, label %if.end3 44 45if.then: ; preds = %for.body 46 %call = call i32 (...) @f() 47 br label %S 48 49S: ; preds = %if.then 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 55 br label %if.end3 56 57if.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 62 br label %for.inc 63 64for.inc: ; preds = %if.end3, %if.then2 65 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 66 br label %for.cond 67 68for.end: ; preds = %for.cond 69 ret void 70} 71 72declare i32 @f(...) 73