aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/LoopPredication.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2019-04-18 17:01:19 +0000
committerPhilip Reames <listmail@philipreames.com>2019-04-18 17:01:19 +0000
commitadf288c5d93e60a91fe226ae2dcebad0f760a259 (patch)
tree1f6d97c45218e63cbee36c5a5db4d7953068b9ee /llvm/lib/Transforms/Scalar/LoopPredication.cpp
parent51fa60bcbb91961849bef930584ec08ddad8eecf (diff)
downloadllvm-adf288c5d93e60a91fe226ae2dcebad0f760a259.zip
llvm-adf288c5d93e60a91fe226ae2dcebad0f760a259.tar.gz
llvm-adf288c5d93e60a91fe226ae2dcebad0f760a259.tar.bz2
[LoopPred] Fix a blatantly obvious bug in r358684
The bug is that I didn't check whether the operand of the invariant_loads were themselves invariant. I don't know how this got missed in the patch and review. I even had an unreduced test case locally, and I remember handling this case, but I must have lost it in one of the rebases. Oops. llvm-svn: 358688
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopPredication.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopPredication.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopPredication.cpp b/llvm/lib/Transforms/Scalar/LoopPredication.cpp
index 0fc796e..15e5b64 100644
--- a/llvm/lib/Transforms/Scalar/LoopPredication.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopPredication.cpp
@@ -510,7 +510,7 @@ bool LoopPredication::isLoopInvariantValue(const SCEV* S) {
// TODO: This should be sunk inside SCEV.
if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(S))
if (const auto *LI = dyn_cast<LoadInst>(U->getValue()))
- if (LI->isUnordered())
+ if (LI->isUnordered() && L->hasLoopInvariantOperands(LI))
if (AA->pointsToConstantMemory(LI->getOperand(0)) ||
LI->getMetadata(LLVMContext::MD_invariant_load) != nullptr)
return true;