From f54c8370e55fdb7d8988fd8f3fc625d2f8a73bcf Mon Sep 17 00:00:00 2001 From: Nirav Dave Date: Tue, 1 Aug 2017 17:19:41 +0000 Subject: [DAG] Convert extload check to equivalent type check. NFC. Replace check with check that consuming store has the same type. llvm-svn: 309708 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 6dd9e9271b4..f10491986fe 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -12566,9 +12566,15 @@ void DAGCombiner::getStoreMergeCandidates( bool IsLoadSrc = isa(St->getValue()); BaseIndexOffset LBasePtr; // Match on loadbaseptr if relevant. - if (IsLoadSrc) - LBasePtr = BaseIndexOffset::match( - cast(St->getValue())->getBasePtr(), DAG); + EVT LoadVT; + if (IsLoadSrc) { + auto *Ld = cast(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::getStoreMergeCandidates( // The Load's Base Ptr must also match if (LoadSDNode *OtherLd = dyn_cast(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; -- cgit v1.2.3