-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EraVM] Only generate GEPs that dominate latch BB in EraVMIndexedMemO…
…psPrepare In case we generate GEP that doesn't dominate latch BB, we will run into an issue and verifier will complain: ``` Instruction does not dominate all uses! %3 = getelementptr inbounds i256, ptr addrspace(1) %0, i256 1 %0 = phi ptr addrspace(1) [ %arg3, %bb1 ], [ %3, %bb5 ] ``` This patch fixes this issue. Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
- Loading branch information
1 parent
6db0b6f
commit 4da3cc2
Showing
2 changed files
with
55 additions
and
1 deletion.
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
43 changes: 43 additions & 0 deletions
43
llvm/test/CodeGen/EraVM/indexed-memops-gep-dominate-bug.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,43 @@ | ||
; RUN: llc -O3 -stop-after=verify -compile-twice=false < %s | FileCheck %s | ||
|
||
target datalayout = "E-p:256:256-i256:256:256-S32-a:256:256" | ||
target triple = "eravm" | ||
|
||
define i256 @test(i256 %arg, ptr addrspace(1) %arg1, ptr addrspace(1) %arg2) { | ||
; CHECK-LABEL: @test( | ||
entry: | ||
%icmp1 = icmp eq i256 %arg, 0 | ||
br i1 %icmp1, label %bb7, label %bb1 | ||
|
||
bb1: | ||
br label %bb2 | ||
|
||
bb2: | ||
%phi1 = phi i256 [ %add, %bb5 ], [ 0, %bb1 ] | ||
%icmp2 = icmp ugt i256 %phi1, 100 | ||
br i1 %icmp2, label %bb3, label %bb4 | ||
|
||
bb3: | ||
; CHECK: getelementptr inbounds i256, ptr addrspace(1) %arg1, i256 %phi1 | ||
%gep1 = getelementptr inbounds i256, ptr addrspace(1) %arg1, i256 %phi1 | ||
store i256 5, ptr addrspace(1) %gep1, align 32 | ||
br label %bb5 | ||
|
||
bb4: | ||
; CHECK: getelementptr inbounds i256, ptr addrspace(1) %arg2, i256 %phi1 | ||
%gep2 = getelementptr inbounds i256, ptr addrspace(1) %arg2, i256 %phi1 | ||
store i256 10, ptr addrspace(1) %gep2, align 32 | ||
br label %bb5 | ||
|
||
bb5: | ||
%add = add i256 %phi1, 1 | ||
%cmp3 = icmp eq i256 %add, 0 | ||
br i1 %cmp3, label %bb6, label %bb2 | ||
|
||
bb6: | ||
br label %bb7 | ||
|
||
bb7: | ||
%phi2 = phi i256 [ 0, %entry ], [ %add, %bb6 ] | ||
ret i256 %phi2 | ||
} |