diff options
author | Adam Nemet <anemet@apple.com> | 2016-03-24 17:59:26 +0000 |
---|---|---|
committer | Adam Nemet <anemet@apple.com> | 2016-03-24 17:59:26 +0000 |
commit | 7aba60c853634f42988544c8150b3510cc7468fd (patch) | |
tree | 620480ea69e06b3793884e4a4c584934d3185ee2 /llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp | |
parent | 107ac9e1aab2d27e6fdd2956585fbce47a03c627 (diff) | |
download | llvm-7aba60c853634f42988544c8150b3510cc7468fd.zip llvm-7aba60c853634f42988544c8150b3510cc7468fd.tar.gz llvm-7aba60c853634f42988544c8150b3510cc7468fd.tar.bz2 |
[LLE] Check for mismatching types between the store and the load earlier
isDependenceDistanceOfOne asserts that the store and the load access
through the same type. This function is also used by
removeDependencesFromMultipleStores so we need to make sure we filter
out mismatching types before reaching this point.
Now we do this when the initial candidates are gathered.
This is a refinement of the fix made in r262267.
Fixes PR27048.
llvm-svn: 264313
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp b/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp index a048690..1a51df8 100644 --- a/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp +++ b/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp @@ -171,6 +171,12 @@ public: auto *Load = dyn_cast<LoadInst>(Destination); if (!Load) continue; + + // Only progagate the value if they are of the same type. + if (Store->getPointerOperand()->getType() != + Load->getPointerOperand()->getType()) + continue; + Candidates.emplace_front(Load, Store); } @@ -438,10 +444,6 @@ public: unsigned NumForwarding = 0; for (const StoreToLoadForwardingCandidate Cand : StoreToLoadDependences) { DEBUG(dbgs() << "Candidate " << Cand); - // Only progagate value if they are of the same type. - if (Cand.Store->getPointerOperand()->getType() != - Cand.Load->getPointerOperand()->getType()) - continue; // Make sure that the stored values is available everywhere in the loop in // the next iteration. |