mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Fix regression from r151466: an we can't replace uses of an instruction reachable from the entry block with uses of an instruction not reachable from the entry block. PR12231.
llvm-svn: 152595
This commit is contained in:
parent
ce889fff68
commit
77682009bc
@ -94,9 +94,13 @@ static bool ValueDominatesPHI(Value *V, PHINode *P, const DominatorTree *DT) {
|
||||
return true;
|
||||
|
||||
// If we have a DominatorTree then do a precise test.
|
||||
if (DT)
|
||||
return !DT->isReachableFromEntry(P->getParent()) ||
|
||||
!DT->isReachableFromEntry(I->getParent()) || DT->dominates(I, P);
|
||||
if (DT) {
|
||||
if (!DT->isReachableFromEntry(P->getParent()))
|
||||
return true;
|
||||
if (!DT->isReachableFromEntry(I->getParent()))
|
||||
return false;
|
||||
return DT->dominates(I, P);
|
||||
}
|
||||
|
||||
// Otherwise, if the instruction is in the entry block, and is not an invoke,
|
||||
// then it obviously dominates all phi nodes.
|
||||
|
19
test/Transforms/EarlyCSE/instsimplify-dom.ll
Normal file
19
test/Transforms/EarlyCSE/instsimplify-dom.ll
Normal file
@ -0,0 +1,19 @@
|
||||
; RUN: opt -early-cse -S < %s | FileCheck %s
|
||||
; PR12231
|
||||
|
||||
declare i32 @f()
|
||||
|
||||
define i32 @fn() {
|
||||
entry:
|
||||
br label %lbl_1215
|
||||
|
||||
lbl_1215:
|
||||
%ins34 = phi i32 [ %ins35, %xxx ], [ undef, %entry ]
|
||||
ret i32 %ins34
|
||||
|
||||
xxx:
|
||||
%ins35 = call i32 @f()
|
||||
br label %lbl_1215
|
||||
}
|
||||
|
||||
; CHECK: define i32 @fn
|
Loading…
Reference in New Issue
Block a user