Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] Handle pointer-pointer comparisons
This should fix a problem introduced by r225464. llvm-svn: 227404
- Loading branch information
Johannes Doerfert
committed
Jan 29, 2015
1 parent
72b5e5f
commit ef61def
Showing
2 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
polly/test/Isl/CodeGen/pointer-type-pointer-type-comparison.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
; RUN: opt %loadPolly -polly-ast -analyze < %s | FileCheck %s | ||
; RUN: opt %loadPolly -polly-codegen-isl -S < %s | FileCheck %s -check-prefix=CODEGEN | ||
; | ||
; void f(int a[], int N, float *P, float *Q) { | ||
; int i; | ||
; for (i = 0; i < N; ++i) | ||
; if ((P + 1) != Q) | ||
; a[i] = i; | ||
; } | ||
; | ||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | ||
|
||
define void @f(i64* nocapture %a, i64 %N, float * %P, float * %Q) nounwind { | ||
entry: | ||
br label %bb | ||
|
||
bb: | ||
%i = phi i64 [ 0, %entry ], [ %i.inc, %bb.backedge ] | ||
%brcond = icmp ne float* %P, %Q | ||
br i1 %brcond, label %store, label %bb.backedge | ||
|
||
store: | ||
%scevgep = getelementptr i64* %a, i64 %i | ||
store i64 %i, i64* %scevgep | ||
br label %bb.backedge | ||
|
||
bb.backedge: | ||
%i.inc = add nsw i64 %i, 1 | ||
%exitcond = icmp eq i64 %i.inc, %N | ||
br i1 %exitcond, label %return, label %bb | ||
|
||
return: | ||
ret void | ||
} | ||
|
||
; CHECK: if (Q >= P + 1) { | ||
; CHECK: for (int c0 = 0; c0 < N; c0 += 1) | ||
; CHECK: Stmt_store(c0); | ||
; CHECK: } else if (P >= Q + 1) | ||
; CHECK: for (int c0 = 0; c0 < N; c0 += 1) | ||
; CHECK: Stmt_store(c0); | ||
; CHECK: } | ||
|
||
; CODEGEN: %[[Pinc:[_a-zA-Z0-9]+]] = getelementptr float* %P, i64 1 | ||
; CODEGEN-NEXT: icmp uge float* %Q, %[[Pinc]] | ||
; CODEGEN: %[[Qinc:[_a-zA-Z0-9]+]] = getelementptr float* %Q, i64 1 | ||
; CODEGEN-NEXT: icmp uge float* %P, %[[Qinc]] |