diff options
Diffstat (limited to 'llvm/lib/Transforms')
-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 a0486901190..1a51df8a71d 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. |