summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2017-08-01 17:19:41 +0000
committerNirav Dave <niravd@google.com>2017-08-01 17:19:41 +0000
commitf54c8370e55fdb7d8988fd8f3fc625d2f8a73bcf (patch)
treecfd169f8b59500e7a235d732f31a26292eb91783 /llvm/lib
parentec36326d85c7ba2332e508f7dc55fdbb1757c576 (diff)
downloadbcm5719-llvm-f54c8370e55fdb7d8988fd8f3fc625d2f8a73bcf.tar.gz
bcm5719-llvm-f54c8370e55fdb7d8988fd8f3fc625d2f8a73bcf.zip
[DAG] Convert extload check to equivalent type check. NFC.
Replace check with check that consuming store has the same type. llvm-svn: 309708
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp15
1 files changed, 10 insertions, 5 deletions
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<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::getStoreMergeCandidates(
// 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;
OpenPOWER on IntegriCloud