mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
enhance RecursivelyDeleteTriviallyDeadInstructions to make
PHIs dead if they are single-value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60194 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4f02c74a8e
commit
564c0a2330
@ -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…
x
Reference in New Issue
Block a user