mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-02 00:36:36 +00:00
split a complex predicate out to a helper function. Simplify two for loops,
which don't need to check for falling off the end of a block *and* end of phi nodes, since terminators are never phis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129655 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2f108f81c1
commit
8bdc251dc5
@ -830,6 +830,17 @@ static void CheckLineNumbers(const MachineBasicBlock *MBB) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// isFoldedOrDeadInstruction - Return true if the specified instruction is
|
||||||
|
/// side-effect free and is either dead or folded into a generated instruction.
|
||||||
|
/// Return false if it needs to be emitted.
|
||||||
|
static bool isFoldedOrDeadInstruction(const Instruction *I,
|
||||||
|
FunctionLoweringInfo *FuncInfo) {
|
||||||
|
return !I->mayWriteToMemory() &&
|
||||||
|
!isa<TerminatorInst>(I) &&
|
||||||
|
!isa<DbgInfoIntrinsic>(I) &&
|
||||||
|
!FuncInfo->isExportedInst(I);
|
||||||
|
}
|
||||||
|
|
||||||
void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
||||||
// Initialize the Fast-ISel state, if needed.
|
// Initialize the Fast-ISel state, if needed.
|
||||||
FastISel *FastIS = 0;
|
FastISel *FastIS = 0;
|
||||||
@ -856,16 +867,14 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (AllPredsVisited) {
|
if (AllPredsVisited) {
|
||||||
for (BasicBlock::const_iterator I = LLVMBB->begin(), E = LLVMBB->end();
|
for (BasicBlock::const_iterator I = LLVMBB->begin();
|
||||||
I != E && isa<PHINode>(I); ++I) {
|
isa<PHINode>(I); ++I)
|
||||||
FuncInfo->ComputePHILiveOutRegInfo(cast<PHINode>(I));
|
FuncInfo->ComputePHILiveOutRegInfo(cast<PHINode>(I));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
for (BasicBlock::const_iterator I = LLVMBB->begin(), E = LLVMBB->end();
|
for (BasicBlock::const_iterator I = LLVMBB->begin();
|
||||||
I != E && isa<PHINode>(I); ++I) {
|
isa<PHINode>(I); ++I)
|
||||||
FuncInfo->InvalidatePHILiveOutRegInfo(cast<PHINode>(I));
|
FuncInfo->InvalidatePHILiveOutRegInfo(cast<PHINode>(I));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FuncInfo->VisitedBBs.insert(LLVMBB);
|
FuncInfo->VisitedBBs.insert(LLVMBB);
|
||||||
}
|
}
|
||||||
@ -912,10 +921,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||||||
const Instruction *Inst = llvm::prior(BI);
|
const Instruction *Inst = llvm::prior(BI);
|
||||||
|
|
||||||
// If we no longer require this instruction, skip it.
|
// If we no longer require this instruction, skip it.
|
||||||
if (!Inst->mayWriteToMemory() &&
|
if (isFoldedOrDeadInstruction(Inst, FuncInfo))
|
||||||
!isa<TerminatorInst>(Inst) &&
|
|
||||||
!isa<DbgInfoIntrinsic>(Inst) &&
|
|
||||||
!FuncInfo->isExportedInst(Inst))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Bottom-up: reset the insert pos at the top, after any local-value
|
// Bottom-up: reset the insert pos at the top, after any local-value
|
||||||
|
Loading…
Reference in New Issue
Block a user