[llvm] r309708 - [DAG] Convert extload check to equivalent type check. NFC.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 1 10:19:42 PDT 2017
Author: niravd
Date: Tue Aug 1 10:19:41 2017
New Revision: 309708
URL: http://llvm.org/viewvc/llvm-project?rev=309708&view=rev
Log:
[DAG] Convert extload check to equivalent type check. NFC.
Replace check with check that consuming store has the same type.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=309708&r1=309707&r2=309708&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Aug 1 10:19:41 2017
@@ -12566,9 +12566,15 @@ void DAGCombiner::getStoreMergeCandidate
bool IsLoadSrc = isa<LoadSDNode>(St->getValue());
BaseIndexOffset LBasePtr;
// Match on loadbaseptr if relevant.
- if (IsLoadSrc)
- LBasePtr = BaseIndexOffset::match(
- cast<LoadSDNode>(St->getValue())->getBasePtr(), DAG);
+ EVT LoadVT;
+ if (IsLoadSrc) {
+ auto *Ld = cast<LoadSDNode>(St->getValue());
+ LBasePtr = BaseIndexOffset::match(Ld->getBasePtr(), DAG);
+ LoadVT = Ld->getMemoryVT();
+ // Load and store should be the same type.
+ if (MemVT != LoadVT)
+ return;
+ }
auto CandidateMatch = [&](StoreSDNode *Other, BaseIndexOffset &Ptr,
int64_t &Offset) -> bool {
if (Other->isVolatile() || Other->isIndexed())
@@ -12582,8 +12588,7 @@ void DAGCombiner::getStoreMergeCandidate
// The Load's Base Ptr must also match
if (LoadSDNode *OtherLd = dyn_cast<LoadSDNode>(Other->getValue())) {
auto LPtr = BaseIndexOffset::match(OtherLd->getBasePtr(), DAG);
- // We do not handle extended loads
- if (OtherLd->getExtensionType() != ISD::NON_EXTLOAD)
+ if (LoadVT != OtherLd->getMemoryVT())
return false;
if (!(LBasePtr.equalBaseIndex(LPtr, DAG)))
return false;
More information about the llvm-commits
mailing list