From a869856c6020d8135901f93fd696c2fdd00854ea Mon Sep 17 00:00:00 2001 From: Nirav Dave Date: Wed, 20 Dec 2017 19:06:47 +0000 Subject: [PATCH] [DAG] Fix condition on overlapping store check. Prevent overlapping store elision when overlapping store is pre-inc/dec as analysis is wrong in these cases. llvm-svn: 321204 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 2dbcc1f..e751e1a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -13786,8 +13786,8 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) { // Deal with elidable overlapping chained stores. if (StoreSDNode *ST1 = dyn_cast(Chain)) - if (OptLevel != CodeGenOpt::None && ST1->isUnindexed() && - !ST1->isVolatile() && ST1->hasOneUse() && + if (OptLevel != CodeGenOpt::None && ST->isUnindexed() && + ST1->isUnindexed() && !ST1->isVolatile() && ST1->hasOneUse() && !ST1->getBasePtr().isUndef() && !ST->isVolatile()) { BaseIndexOffset STBasePtr = BaseIndexOffset::match(ST->getBasePtr(), DAG); BaseIndexOffset ST1BasePtr = -- 2.7.4