mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 23:18:58 +00:00
simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60190 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cb03f8547d
commit
15678533f3
@ -27,6 +27,7 @@
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Type.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "llvm/Analysis/ConstantFolding.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
@ -348,10 +349,17 @@ void TailDup::eliminateUnconditionalBranch(BranchInst *Branch) {
|
||||
// instructions one last time, constant propagating and DCE'ing them, because
|
||||
// they may not be needed anymore.
|
||||
//
|
||||
if (HadPHINodes)
|
||||
while (BI != SourceBlock->end())
|
||||
if (!dceInstruction(BI) && !doConstantPropagation(BI))
|
||||
++BI;
|
||||
if (HadPHINodes) {
|
||||
while (BI != SourceBlock->end()) {
|
||||
Instruction *Inst = BI++;
|
||||
if (isInstructionTriviallyDead(Inst))
|
||||
Inst->eraseFromParent();
|
||||
else if (Constant *C = ConstantFoldInstruction(Inst)) {
|
||||
Inst->replaceAllUsesWith(C);
|
||||
Inst->eraseFromParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
++NumEliminated; // We just killed a branch!
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user