diff options
author | James Molloy <james.molloy@arm.com> | 2015-02-16 17:02:00 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2015-02-16 17:02:00 +0000 |
commit | e32d806b5faac6533adabf00bdc1cf5284cfe5e6 (patch) | |
tree | 81fefdd9e13cd830a5fbb9129385200364d2a8b9 /llvm/lib/Transforms/Scalar | |
parent | 4c7deb2259cc12fc7f70f71eec76bebc8dfaf727 (diff) | |
download | bcm5719-llvm-e32d806b5faac6533adabf00bdc1cf5284cfe5e6.tar.gz bcm5719-llvm-e32d806b5faac6533adabf00bdc1cf5284cfe5e6.zip |
[LoopReroll] Relax some assumptions a little.
We won't find a root with index zero in any loop that we are able to reroll.
However, we may find one in a non-rerollable loop, so bail gracefully instead
of failing hard.
llvm-svn: 229406
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopRerollPass.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp b/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp index 704299f3041..fdf7e3b1b19 100644 --- a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp @@ -719,14 +719,17 @@ collectPossibleRoots(Instruction *Base, std::map<int64_t,Instruction*> &Roots) { if (Roots.empty()) return false; - - assert(Roots.find(0) == Roots.end() && "Didn't expect a zero index!"); // If we found non-loop-inc, non-root users of Base, assume they are // for the zeroth root index. This is because "add %a, 0" gets optimized // away. - if (BaseUsers.size()) + if (BaseUsers.size()) { + if (Roots.find(0) != Roots.end()) { + DEBUG(dbgs() << "LRR: Multiple roots found for base - aborting!\n"); + return false; + } Roots[0] = Base; + } // Calculate the number of users of the base, or lowest indexed, iteration. unsigned NumBaseUses = BaseUsers.size(); |