mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-26 18:20:39 +00:00
CVP: If we have a PHI with an incoming select, try to skip the select.
This is a common pattern with dyn_cast and similar constructs, when the PHI no longer depends on the select it can often be turned into a simpler construct or even get hoisted out of the loop. PR15340. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175995 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -81,6 +81,26 @@ LessThanOrEqualToTwo:
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
declare i32* @f(i32*)
|
||||
define void @test5(i32* %x, i32* %y) {
|
||||
; CHECK: @test5
|
||||
entry:
|
||||
%pre = icmp eq i32* %x, null
|
||||
br i1 %pre, label %return, label %loop
|
||||
|
||||
loop:
|
||||
%phi = phi i32* [ %sel, %loop ], [ %x, %entry ]
|
||||
; CHECK: %phi = phi i32* [ %f, %loop ], [ %x, %entry ]
|
||||
%f = tail call i32* @f(i32* %phi)
|
||||
%cmp1 = icmp ne i32* %f, %y
|
||||
%sel = select i1 %cmp1, i32* %f, i32* null
|
||||
%cmp2 = icmp eq i32* %sel, null
|
||||
br i1 %cmp2, label %return, label %loop
|
||||
|
||||
return:
|
||||
ret void
|
||||
}
|
||||
|
||||
define i32 @switch1(i32 %s) {
|
||||
; CHECK: @switch1
|
||||
entry:
|
||||
|
||||
Reference in New Issue
Block a user