-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support PHI in LowerAddrSpaceCastPass (#1348)
* Support PHI in LowerAddrSpaceCastPass * Update test/AddressSpaceCast/issue-1341.ll Co-authored-by: Romaric Jodin <[email protected]> --------- Co-authored-by: Romaric Jodin <[email protected]>
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 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
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
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,24 @@ | ||
; RUN: clspv-opt %s -o %t.ll --passes=lower-addrspacecast | ||
; RUN: FileCheck %s < %t.ll | ||
|
||
; CHECK: arrayinit.body: | ||
; CHECK-NEXT: {{.*}} = phi ptr [ %{{.*}}, %entry ], [ %{{.*}}, %arrayinit.body ] | ||
; CHECK-NOT: %arrayinit.cur = phi ptr addrspace(4) [ %arrayinit.begin, %entry ], [ %arrayinit.next, %arrayinit.body ] | ||
|
||
define dso_local spir_kernel void @fun() { | ||
entry: | ||
%mem = alloca [4 x float] | ||
%data = addrspacecast ptr %mem to ptr addrspace(4) | ||
%arrayinit.begin = getelementptr inbounds [4 x float], ptr addrspace(4) %data, i32 0, i32 0 | ||
%arrayinit.end = getelementptr inbounds float, ptr addrspace(4) %arrayinit.begin, i32 4 | ||
br label %arrayinit.body | ||
|
||
arrayinit.body: | ||
%arrayinit.cur = phi ptr addrspace(4) [ %arrayinit.begin, %entry ], [ %arrayinit.next, %arrayinit.body ] | ||
%arrayinit.next = getelementptr inbounds float, ptr addrspace(4) %arrayinit.cur, i32 1 | ||
%arrayinit.done = icmp eq ptr addrspace(4) %arrayinit.next, %arrayinit.end | ||
br i1 %arrayinit.done, label %arrayinit.end2, label %arrayinit.body | ||
|
||
arrayinit.end2: | ||
ret void | ||
} |