mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
The expression icmp eq (select (icmp eq x, 0), 1, x), 0 folds to false.
Spotted by my super-optimizer in 186.crafty and 450.soplex. We really need a proper infrastructure for handling generalizations of this kind of thing (which occur a lot), however this case is so simple that I decided to go ahead and implement it directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143214 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -204,6 +204,15 @@ define i1 @select4(i1 %cond) {
|
||||
; CHECK: ret i1 %cond
|
||||
}
|
||||
|
||||
define i1 @select5(i32 %x) {
|
||||
; CHECK: @select5
|
||||
%c = icmp eq i32 %x, 0
|
||||
%s = select i1 %c, i32 1, i32 %x
|
||||
%c2 = icmp eq i32 %s, 0
|
||||
ret i1 %c2
|
||||
; CHECK: ret i1 false
|
||||
}
|
||||
|
||||
define i1 @urem1(i32 %X, i32 %Y) {
|
||||
; CHECK: @urem1
|
||||
%A = urem i32 %X, %Y
|
||||
|
Reference in New Issue
Block a user