-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SimplifyCFG] teach simplifycfg not to introduce ptrtoint for NI poin…
…ters SimplifyCFG expects to be able to cast both sides to an int, if either side can be case to an int, but this is not desirable or legal, in general, per D104547. Spotted in JuliaLang/julia#45702 Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D128670
- Loading branch information
1 parent
d2301c3
commit 52bd24c
Showing
2 changed files
with
30 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
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,28 @@ | ||
; RUN: opt -passes=simplifycfg -S < %s | FileCheck %s | ||
|
||
target datalayout = "ni:1" | ||
|
||
define void @test_01(i64 addrspace(1)* align 8 %ptr) { | ||
; CHECK-LABEL: @test_01( | ||
; CHECK-NOT: ptrtoint | ||
; CHECK-NEXT: icmp eq i64 addrspace(1)* %ptr, null | ||
; CHECK-NOT: ptrtoint | ||
%cond1 = icmp eq i64 addrspace(1)* %ptr, null | ||
%cond2 = icmp eq i64 addrspace(1)* %ptr, null | ||
br i1 %cond1, label %true1, label %false1 | ||
|
||
true1: | ||
br i1 %cond2, label %true2, label %false2 | ||
|
||
false1: | ||
store i64 1, i64 addrspace(1)* %ptr, align 8 | ||
br label %true1 | ||
|
||
true2: | ||
store i64 2, i64 addrspace(1)* %ptr, align 8 | ||
ret void | ||
|
||
false2: | ||
store i64 3, i64 addrspace(1)* %ptr, align 8 | ||
ret void | ||
} |