llvm-project/polly/test/ScopInfo/pointer-comparison.ll
rahulana-quic e1f056f692
Reland "[polly] Port polly tests to use NPM" (#92918)
Even as the NPM has been in use by Polly for a while now, the majority
of the tests continue using the LPM passes. This patch ports the tests
to use the NPM passes (for example, by replacing a flag such as
-polly-detect with -passes=polly-detect following the NPM syntax for
specifying passes) with some exceptions for some missing features in the
new passes.

Relanding #90632.
2024-05-24 13:09:34 -07:00

39 lines
1.3 KiB
LLVM

; RUN: opt %loadNPMPolly '-passes=print<polly-function-scops>' -disable-output < %s 2>&1 | FileCheck %s
;
; TODO: FIXME: Investigate why we need a InvalidContext here.
;
; void f(int *A, int *B) {
; while (A != B) {
; *A = *A + 1;
; A++;
; }
; }
;
; CHECK: Invalid Context:
; CHECK-NEXT: [A, B] -> { : (4*floor((A - B)/4) < A - B) or ((-A + B) mod 4 = 0 and B >= 9223372036854775808 + A) or ((-A + B) mod 4 = 0 and B <= -4 + A) }
;
; CHECK: Domain :=
; CHECK-NEXT: [A, B] -> { Stmt_while_body[i0] : (-A + B) mod 4 = 0 and i0 >= 0 and 4i0 <= -4 - A + B };
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @f(ptr %A, ptr %B) {
entry:
br label %while.cond
while.cond: ; preds = %while.body, %entry
%A.addr.0 = phi ptr [ %A, %entry ], [ %incdec.ptr, %while.body ]
%cmp = icmp eq ptr %A.addr.0, %B
br i1 %cmp, label %while.end, label %while.body
while.body: ; preds = %while.cond
%tmp = load i32, ptr %A.addr.0, align 4
%add = add nsw i32 %tmp, 1
store i32 %add, ptr %A.addr.0, align 4
%incdec.ptr = getelementptr inbounds i32, ptr %A.addr.0, i64 1
br label %while.cond
while.end: ; preds = %while.cond
ret void
}