1; RUN: opt %loadNPMPolly '-passes=print<polly-detect>,print<polly-function-scops>' -disable-output < %s 2>&1 | \ 2; RUN: FileCheck %s -check-prefix=NONAFFINE 3; RUN: opt %loadNPMPolly '-passes=print<polly-detect>,print<polly-function-scops>' -disable-output \ 4; RUN: -polly-allow-nonaffine-branches=false < %s 2>&1 | \ 5; RUN: FileCheck %s -check-prefix=NO-NONEAFFINE 6 7; NONAFFINE-NOT: Statements 8 9; NO-NONEAFFINE: Statements { 10; NO-NONEAFFINE-NEXT: Stmt_then 11; NO-NONEAFFINE-NEXT: Domain := 12; NO-NONEAFFINE-NEXT: [p_0] -> { Stmt_then[] : p_0 <= -2 or p_0 >= 0 }; 13; NO-NONEAFFINE-NEXT: Schedule := 14; NO-NONEAFFINE-NEXT: [p_0] -> { Stmt_then[] -> [] }; 15; NO-NONEAFFINE-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] 16; NO-NONEAFFINE-NEXT: [p_0] -> { Stmt_then[] -> MemRef_A[0] }; 17; NO-NONEAFFINE-NEXT: } 18 19; Verify that this test case does not crash -polly-scops. The problem in 20; this test case is that the branch instruction in %branch references 21; a scalar evolution expression for which no useful value can be computed at the 22; location %branch, as the loop %loop does not terminate. At some point, we 23; did not identify the branch condition as non-affine during scop detection. 24; This test verifies that we either model the branch condition as non-affine 25; region (and return an empty scop) or only detect a smaller region if 26; non-affine conditions are not allowed. 27 28target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 29target triple = "aarch64--linux-android" 30 31define void @f(i16 %event, ptr %A) { 32entry: 33 br label %loop 34 35loop: 36 %indvar = phi i8 [ 0, %entry ], [ %indvar.next, %loop ] 37 %indvar.next = add i8 %indvar, 1 38 %cmp = icmp eq i8 %indvar.next, 0 39 br i1 false, label %branch, label %loop 40 41branch: 42 br i1 %cmp, label %end, label %then 43 44then: 45 store float 1.0, ptr %A 46 br label %end 47 48end: 49 ret void 50} 51