[llvm] r353527 - Revert r353416 "[DAG] Cleanup unused nodes on failed store-to-load forward combine."
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 8 07:21:13 PST 2019
Author: niravd
Date: Fri Feb 8 07:21:13 2019
New Revision: 353527
URL: http://llvm.org/viewvc/llvm-project?rev=353527&view=rev
Log:
Revert r353416 "[DAG] Cleanup unused nodes on failed store-to-load forward combine."
This cleanup causes out-of-tree crashes.
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=353527&r1=353526&r2=353527&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Feb 8 07:21:13 2019
@@ -13154,42 +13154,30 @@ SDValue DAGCombiner::ForwardStoreValueTo
if (LD->getBasePtr().isUndef() || Offset != 0)
return SDValue();
// Model necessary truncations / extenstions.
- SmallVector<SDNode *, 4> Vals; // Temporaries which may need to be deleted.
- SDValue Val, RV;
+ SDValue Val;
// Truncate Value To Stored Memory Size.
do {
if (!getTruncatedStoreValue(ST, Val))
continue;
- if (Vals.empty() || Vals.back() != Val.getNode())
- Vals.push_back(Val.getNode());
if (!isTypeLegal(LDMemType))
continue;
if (STMemType != LDMemType) {
// TODO: Support vectors? This requires extract_subvector/bitcast.
if (!STMemType.isVector() && !LDMemType.isVector() &&
- STMemType.isInteger() && LDMemType.isInteger()) {
- Vals.push_back(Val.getNode());
+ STMemType.isInteger() && LDMemType.isInteger())
Val = DAG.getNode(ISD::TRUNCATE, SDLoc(LD), LDMemType, Val);
- } else
+ else
continue;
}
- if (Vals.empty() || Vals.back() != Val.getNode())
- Vals.push_back(Val.getNode());
- if (extendLoadedValueToExtension(LD, Val))
- RV = ReplaceLd(LD, Val, Chain);
- else if (Vals.empty() || Vals.back() != Val.getNode())
- Vals.push_back(Val.getNode());
+ if (!extendLoadedValueToExtension(LD, Val))
+ continue;
+ return ReplaceLd(LD, Val, Chain);
} while (false);
// On failure, cleanup dead nodes we may have created.
- if (Vals.empty() || Vals.back() != Val.getNode())
- Vals.push_back(Val.getNode());
- while (!Vals.empty()) {
- SDNode *Val = Vals.pop_back_val();
- if (Val->use_empty())
- recursivelyDeleteUnusedNodes(Val);
- }
- return RV;
+ if (Val->use_empty())
+ deleteAndRecombine(Val.getNode());
+ return SDValue();
}
SDValue DAGCombiner::visitLOAD(SDNode *N) {
More information about the llvm-commits
mailing list