mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-03 09:14:30 +00:00
Refactor the code for computing the insertion point for an expression into
a separate function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100845 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8c0a1608d5
commit
d96eae8010
@ -1236,6 +1236,10 @@ public:
|
|||||||
DenseSet<const SCEV *> &VisitedRegs) const;
|
DenseSet<const SCEV *> &VisitedRegs) const;
|
||||||
void Solve(SmallVectorImpl<const Formula *> &Solution) const;
|
void Solve(SmallVectorImpl<const Formula *> &Solution) const;
|
||||||
|
|
||||||
|
BasicBlock::iterator AdjustInputPositionForExpand(BasicBlock::iterator IP,
|
||||||
|
const LSRFixup &LF,
|
||||||
|
const LSRUse &LU) const;
|
||||||
|
|
||||||
Value *Expand(const LSRFixup &LF,
|
Value *Expand(const LSRFixup &LF,
|
||||||
const Formula &F,
|
const Formula &F,
|
||||||
BasicBlock::iterator IP,
|
BasicBlock::iterator IP,
|
||||||
@ -2801,14 +2805,13 @@ static BasicBlock *getImmediateDominator(BasicBlock *BB, DominatorTree &DT) {
|
|||||||
return Node->getBlock();
|
return Node->getBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *LSRInstance::Expand(const LSRFixup &LF,
|
/// AdjustInputPositionForExpand - Determine an input position which will be
|
||||||
const Formula &F,
|
/// dominated by the operands and which will dominate the result.
|
||||||
BasicBlock::iterator IP,
|
BasicBlock::iterator
|
||||||
SCEVExpander &Rewriter,
|
LSRInstance::AdjustInputPositionForExpand(BasicBlock::iterator IP,
|
||||||
SmallVectorImpl<WeakVH> &DeadInsts) const {
|
const LSRFixup &LF,
|
||||||
const LSRUse &LU = Uses[LF.LUIdx];
|
const LSRUse &LU) const {
|
||||||
|
// Collect some instructions which must be dominated by the
|
||||||
// Then, collect some instructions which must be dominated by the
|
|
||||||
// expanding replacement. These must be dominated by any operands that
|
// expanding replacement. These must be dominated by any operands that
|
||||||
// will be required in the expansion.
|
// will be required in the expansion.
|
||||||
SmallVector<Instruction *, 4> Inputs;
|
SmallVector<Instruction *, 4> Inputs;
|
||||||
@ -2867,9 +2870,27 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
|
|||||||
else
|
else
|
||||||
IP = Tentative;
|
IP = Tentative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't insert instructions before PHI nodes.
|
||||||
while (isa<PHINode>(IP)) ++IP;
|
while (isa<PHINode>(IP)) ++IP;
|
||||||
|
|
||||||
|
// Ignore debug intrinsics.
|
||||||
while (isa<DbgInfoIntrinsic>(IP)) ++IP;
|
while (isa<DbgInfoIntrinsic>(IP)) ++IP;
|
||||||
|
|
||||||
|
return IP;
|
||||||
|
}
|
||||||
|
|
||||||
|
Value *LSRInstance::Expand(const LSRFixup &LF,
|
||||||
|
const Formula &F,
|
||||||
|
BasicBlock::iterator IP,
|
||||||
|
SCEVExpander &Rewriter,
|
||||||
|
SmallVectorImpl<WeakVH> &DeadInsts) const {
|
||||||
|
const LSRUse &LU = Uses[LF.LUIdx];
|
||||||
|
|
||||||
|
// Determine an input position which will be dominated by the operands and
|
||||||
|
// which will dominate the result.
|
||||||
|
IP = AdjustInputPositionForExpand(IP, LF, LU);
|
||||||
|
|
||||||
// Inform the Rewriter if we have a post-increment use, so that it can
|
// Inform the Rewriter if we have a post-increment use, so that it can
|
||||||
// perform an advantageous expansion.
|
// perform an advantageous expansion.
|
||||||
Rewriter.setPostInc(LF.PostIncLoops);
|
Rewriter.setPostInc(LF.PostIncLoops);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user