forked from OSchip/llvm-project
If the loop executes a constant number of times, try a bit harder to replace
exit values. llvm-svn: 13018
This commit is contained in:
parent
4021d1af5a
commit
a814080025
|
@ -276,6 +276,8 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L) {
|
|||
BasicBlock::iterator InsertPt = BlockToInsertInto->begin();
|
||||
while (isa<PHINode>(InsertPt)) ++InsertPt;
|
||||
|
||||
bool HasConstantItCount = isa<SCEVConstant>(SE->getIterationCount(L));
|
||||
|
||||
std::set<Instruction*> InstructionsToDelete;
|
||||
|
||||
for (unsigned i = 0, e = L->getBlocks().size(); i != e; ++i)
|
||||
|
@ -284,7 +286,8 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L) {
|
|||
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
|
||||
if (I->getType()->isInteger()) { // Is an integer instruction
|
||||
SCEVHandle SH = SE->getSCEV(I);
|
||||
if (SH->hasComputableLoopEvolution(L)) { // Varies predictably
|
||||
if (SH->hasComputableLoopEvolution(L) || // Varies predictably
|
||||
HasConstantItCount) {
|
||||
// Find out if this predictably varying value is actually used
|
||||
// outside of the loop. "extra" as opposed to "intra".
|
||||
std::vector<User*> ExtraLoopUsers;
|
||||
|
|
Loading…
Reference in New Issue