1 ; RUN: opt %loadPolly -polly-print-ast -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s -check-prefix=CODEGEN
5 ; void f(int a[], int N, float *P, float *Q) {
7 ; for (i = 0; i < N; ++i)
12 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
14 define void @f(ptr nocapture %a, i64 %N, ptr %P, ptr %Q) nounwind {
19 %i = phi i64 [ 0, %entry ], [ %i.inc, %bb.backedge ]
20 %brcond = icmp ne ptr %P, %Q
21 br i1 %brcond, label %store, label %bb.backedge
24 %scevgep = getelementptr inbounds i64, ptr %a, i64 %i
25 store i64 %i, ptr %scevgep
29 %i.inc = add nsw i64 %i, 1
30 %exitcond = icmp eq i64 %i.inc, %N
31 br i1 %exitcond, label %return, label %bb
37 ; CHECK: if (Q >= P + 1 || P >= Q + 1)
38 ; CHECK-NEXT: for (int c0 = 0; c0 < N; c0 += 1)
39 ; CHECK-NEXT: Stmt_store(c0);
41 ; CODEGEN: polly.cond:
42 ; CODEGEN-NEXT: %[[Q:[_a-zA-Z0-9]+]] = ptrtoint ptr %Q to i64
43 ; CODEGEN-NEXT: %[[P:[_a-zA-Z0-9]+]] = ptrtoint ptr %P to i64
44 ; CODEGEN-NEXT: %[[PInc:[_a-zA-Z0-9]+]] = add nsw i64 %[[P]], 1
45 ; CODEGEN-NEXT: %[[CMP:[_a-zA-Z0-9]+]] = icmp sge i64 %[[Q]], %[[PInc]]
46 ; CODEGEN-NEXT: %[[P2:[_a-zA-Z0-9]+]] = ptrtoint ptr %P to i64
47 ; CODEGEN-NEXT: %[[Q2:[_a-zA-Z0-9]+]] = ptrtoint ptr %Q to i64
48 ; CODEGEN-NEXT: %[[QInc:[_a-zA-Z0-9]+]] = add nsw i64 %[[Q2]], 1
49 ; CODEGEN-NEXT: %[[CMP2:[_a-zA-Z0-9]+]] = icmp sge i64 %[[P2]], %[[QInc]]
50 ; CODEGEN-NEXT: %[[CMP3:[_a-zA-Z0-9]+]] = or i1 %[[CMP]], %[[CMP2]]
51 ; CODEGEN-NEXT: br i1 %[[CMP3]]