summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-05-10 18:47:18 +0000
committerChris Lattner <sabre@nondot.org>2004-05-10 18:47:18 +0000
commita2f7b9bddceb0cfcc09461189ba24e7a3f055489 (patch)
tree5627443b3c3ea3f490076d697f26b311a4d1e79c
parent72fb3256f8fdb5440caab5b728b2254c141e4c36 (diff)
downloadbcm5719-llvm-a2f7b9bddceb0cfcc09461189ba24e7a3f055489.tar.gz
bcm5719-llvm-a2f7b9bddceb0cfcc09461189ba24e7a3f055489.zip
Now that we use an ilist of machine instructions, iterators are more robust
than before. Because this is the case, we can compute the first non-phi instruction once when de-phi'ing a block. This shaves ~4s off of phielimination of _Z7yyparsev in kimwitu++ from 109s -> 105s. There are still much more important gains to come. llvm-svn: 13452
-rw-r--r--llvm/lib/CodeGen/PHIElimination.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp
index 180cb6d7935..ffde4beaf0a 100644
--- a/llvm/lib/CodeGen/PHIElimination.cpp
+++ b/llvm/lib/CodeGen/PHIElimination.cpp
@@ -68,6 +68,13 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) {
const TargetInstrInfo &MII = MF.getTarget().getInstrInfo();
const MRegisterInfo *RegInfo = MF.getTarget().getRegisterInfo();
+ // Get an iterator to the first instruction after the last PHI node (this may
+ // allso be the end of the basic block).
+ MachineBasicBlock::iterator AfterPHIsIt = MBB.begin();
+ while (AfterPHIsIt != MBB.end() &&
+ AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI)
+ ++AfterPHIsIt; // Skip over all of the PHI nodes...
+
while (MBB.front().getOpcode() == TargetInstrInfo::PHI) {
// Unlink the PHI node from the basic block... but don't delete the PHI yet
MachineInstr *MI = MBB.remove(MBB.begin());
@@ -85,15 +92,11 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) {
// after any remaining phi nodes) which copies the new incoming register
// into the phi node destination.
//
- MachineBasicBlock::iterator AfterPHIsIt = MBB.begin();
- while (AfterPHIsIt != MBB.end() &&
- AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI)
- ++AfterPHIsIt; // Skip over all of the PHI nodes...
RegInfo->copyRegToReg(MBB, AfterPHIsIt, DestReg, IncomingReg, RC);
// Update live variable information if there is any...
if (LV) {
- MachineInstr *PHICopy = --AfterPHIsIt;
+ MachineInstr *PHICopy = prior(AfterPHIsIt);
// Add information to LiveVariables to know that the incoming value is
// killed. Note that because the value is defined in several places (once
OpenPOWER on IntegriCloud