mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places to
use it instead of duplicating its functionality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51499 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -472,8 +472,7 @@ void LICM::sink(Instruction &I) {
|
||||
// nodes in it.
|
||||
I.removeFromParent();
|
||||
|
||||
BasicBlock::iterator InsertPt = ExitBlocks[0]->begin();
|
||||
while (isa<PHINode>(InsertPt)) ++InsertPt;
|
||||
BasicBlock::iterator InsertPt = ExitBlocks[0]->getFirstNonPHI();
|
||||
ExitBlocks[0]->getInstList().insert(InsertPt, &I);
|
||||
}
|
||||
} else if (ExitBlocks.empty()) {
|
||||
@@ -542,8 +541,7 @@ void LICM::sink(Instruction &I) {
|
||||
// If we haven't already processed this exit block, do so now.
|
||||
if (InsertedBlocks.insert(ExitBlock).second) {
|
||||
// Insert the code after the last PHI node...
|
||||
BasicBlock::iterator InsertPt = ExitBlock->begin();
|
||||
while (isa<PHINode>(InsertPt)) ++InsertPt;
|
||||
BasicBlock::iterator InsertPt = ExitBlock->getFirstNonPHI();
|
||||
|
||||
// If this is the first exit block processed, just move the original
|
||||
// instruction, otherwise clone the original instruction and insert
|
||||
@@ -735,9 +733,7 @@ void LICM::PromoteValuesInLoop() {
|
||||
continue;
|
||||
|
||||
// Copy all of the allocas into their memory locations.
|
||||
BasicBlock::iterator BI = ExitBlocks[i]->begin();
|
||||
while (isa<PHINode>(*BI))
|
||||
++BI; // Skip over all of the phi nodes in the block.
|
||||
BasicBlock::iterator BI = ExitBlocks[i]->getFirstNonPHI();
|
||||
Instruction *InsertPos = BI;
|
||||
unsigned PVN = 0;
|
||||
for (unsigned i = 0, e = PromotedValues.size(); i != e; ++i) {
|
||||
|
Reference in New Issue
Block a user