mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-01 17:32:36 +00:00
cache dereferenced iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108131 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3472766f9e
commit
a8b9df7bd9
@ -206,13 +206,14 @@ static BasicBlock *FindObviousSharedDomOf(BasicBlock *SrcBlock,
|
|||||||
// there is only one other pred, get it, otherwise we can't handle it.
|
// there is only one other pred, get it, otherwise we can't handle it.
|
||||||
PI = pred_begin(DstBlock); PE = pred_end(DstBlock);
|
PI = pred_begin(DstBlock); PE = pred_end(DstBlock);
|
||||||
BasicBlock *DstOtherPred = 0;
|
BasicBlock *DstOtherPred = 0;
|
||||||
if (*PI == SrcBlock) {
|
BasicBlock *P = *PI;
|
||||||
|
if (P == SrcBlock) {
|
||||||
if (++PI == PE) return 0;
|
if (++PI == PE) return 0;
|
||||||
DstOtherPred = *PI;
|
DstOtherPred = P;
|
||||||
if (++PI != PE) return 0;
|
if (++PI != PE) return 0;
|
||||||
} else {
|
} else {
|
||||||
DstOtherPred = *PI;
|
DstOtherPred = P;
|
||||||
if (++PI == PE || *PI != SrcBlock || ++PI != PE) return 0;
|
if (++PI == PE || P != SrcBlock || ++PI != PE) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can handle two situations here: "if then" and "if then else" blocks. An
|
// We can handle two situations here: "if then" and "if then else" blocks. An
|
||||||
|
@ -476,10 +476,11 @@ bool TailCallElim::ProcessReturningBlock(ReturnInst *Ret, BasicBlock *&OldEntry,
|
|||||||
// it will not show up as a predecessor.
|
// it will not show up as a predecessor.
|
||||||
for (pred_iterator PI = pred_begin(OldEntry), PE = pred_end(OldEntry);
|
for (pred_iterator PI = pred_begin(OldEntry), PE = pred_end(OldEntry);
|
||||||
PI != PE; ++PI) {
|
PI != PE; ++PI) {
|
||||||
if (*PI == &F->getEntryBlock())
|
BasicBlock *P = *PI;
|
||||||
AccPN->addIncoming(AccumulatorRecursionEliminationInitVal, *PI);
|
if (P == &F->getEntryBlock())
|
||||||
|
AccPN->addIncoming(AccumulatorRecursionEliminationInitVal, P);
|
||||||
else
|
else
|
||||||
AccPN->addIncoming(AccPN, *PI);
|
AccPN->addIncoming(AccPN, P);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an incoming argument for the current block, which is computed by our
|
// Add an incoming argument for the current block, which is computed by our
|
||||||
|
@ -286,9 +286,10 @@ bool Instruction::isUsedOutsideOfBlock(const BasicBlock *BB) const {
|
|||||||
for (const_use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
|
for (const_use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
|
||||||
// PHI nodes uses values in the corresponding predecessor block. For other
|
// PHI nodes uses values in the corresponding predecessor block. For other
|
||||||
// instructions, just check to see whether the parent of the use matches up.
|
// instructions, just check to see whether the parent of the use matches up.
|
||||||
const PHINode *PN = dyn_cast<PHINode>(*UI);
|
const User *U = *UI;
|
||||||
|
const PHINode *PN = dyn_cast<PHINode>(U);
|
||||||
if (PN == 0) {
|
if (PN == 0) {
|
||||||
if (cast<Instruction>(*UI)->getParent() != BB)
|
if (cast<Instruction>(U)->getParent() != BB)
|
||||||
return true;
|
return true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user