mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-28 06:27:16 +00:00
enhance RecursivelyDeleteTriviallyDeadInstructions to make
PHIs dead if they are single-value. llvm-svn: 60194
This commit is contained in:
parent
8b382de4e0
commit
53ebef9cbb
@ -190,6 +190,15 @@ void llvm::RecursivelyDeleteTriviallyDeadInstructions(Value *V,
|
||||
while (!Insts.empty()) {
|
||||
I = *Insts.begin();
|
||||
Insts.erase(I);
|
||||
|
||||
// If this is a PHI node, we may be able to make it dead if we know all the
|
||||
// input values are the same.
|
||||
if (PHINode *PN = dyn_cast<PHINode>(I)) {
|
||||
if (Value *PNV = PN->hasConstantValue())
|
||||
PN->replaceAllUsesWith(PNV);
|
||||
}
|
||||
|
||||
// Okay, if the instruction is dead, delete it.
|
||||
if (!isInstructionTriviallyDead(I))
|
||||
continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user