[llvm-commits] [llvm] r92938 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
Benjamin Kramer
benny.kra at googlemail.com
Thu Jan 7 11:46:16 PST 2010
Author: d0k
Date: Thu Jan 7 13:46:15 2010
New Revision: 92938
URL: http://llvm.org/viewvc/llvm-project?rev=92938&view=rev
Log:
Simplify code. No intended functionality/performance change.
Modified:
llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=92938&r1=92937&r2=92938&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original)
+++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Thu Jan 7 13:46:15 2010
@@ -481,32 +481,21 @@
// Search for the use in this block that precedes the instruction we care
// about, going to the fallback case if we don't find it.
- if (UseI == MBB->begin())
- return PerformPHIConstructionFallBack(UseI, MBB, LI, Visited, Defs,
- Uses, NewVNs, LiveOut, Phis,
- IsTopLevel, IsIntraBlock);
-
MachineBasicBlock::iterator Walker = UseI;
- --Walker;
bool found = false;
while (Walker != MBB->begin()) {
+ --Walker;
if (BlockUses.count(Walker)) {
found = true;
break;
}
- --Walker;
- }
-
- // Must check begin() too.
- if (!found) {
- if (BlockUses.count(Walker))
- found = true;
- else
- return PerformPHIConstructionFallBack(UseI, MBB, LI, Visited, Defs,
- Uses, NewVNs, LiveOut, Phis,
- IsTopLevel, IsIntraBlock);
}
+ if (!found)
+ return PerformPHIConstructionFallBack(UseI, MBB, LI, Visited, Defs,
+ Uses, NewVNs, LiveOut, Phis,
+ IsTopLevel, IsIntraBlock);
+
SlotIndex UseIndex = LIs->getInstructionIndex(Walker);
UseIndex = UseIndex.getUseIndex();
SlotIndex EndIndex;
@@ -533,17 +522,11 @@
// This case is basically a merging of the two preceding case, with the
// special note that checking for defs must take precedence over checking
// for uses, because of two-address instructions.
-
- if (UseI == MBB->begin())
- return PerformPHIConstructionFallBack(UseI, MBB, LI, Visited, Defs, Uses,
- NewVNs, LiveOut, Phis,
- IsTopLevel, IsIntraBlock);
-
MachineBasicBlock::iterator Walker = UseI;
- --Walker;
bool foundDef = false;
bool foundUse = false;
while (Walker != MBB->begin()) {
+ --Walker;
if (BlockDefs.count(Walker)) {
foundDef = true;
break;
@@ -551,21 +534,13 @@
foundUse = true;
break;
}
- --Walker;
- }
-
- // Must check begin() too.
- if (!foundDef && !foundUse) {
- if (BlockDefs.count(Walker))
- foundDef = true;
- else if (BlockUses.count(Walker))
- foundUse = true;
- else
- return PerformPHIConstructionFallBack(UseI, MBB, LI, Visited, Defs,
- Uses, NewVNs, LiveOut, Phis,
- IsTopLevel, IsIntraBlock);
}
+ if (!foundDef && !foundUse)
+ return PerformPHIConstructionFallBack(UseI, MBB, LI, Visited, Defs,
+ Uses, NewVNs, LiveOut, Phis,
+ IsTopLevel, IsIntraBlock);
+
SlotIndex StartIndex = LIs->getInstructionIndex(Walker);
StartIndex = foundDef ? StartIndex.getDefIndex() : StartIndex.getUseIndex();
SlotIndex EndIndex;
More information about the llvm-commits
mailing list