[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Oct 10 16:00:20 PDT 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.29 -> 1.30
---
Log message:
clean up some corner cases
---
Diffs of the changes: (+6 -2)
DAGCombiner.cpp | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.29 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.30
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.29 Mon Oct 10 17:31:19 2005
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Oct 10 18:00:08 2005
@@ -1583,14 +1583,18 @@
SDOperand SrcValue = N->getOperand(3);
// If this is a store that kills a previous store, remove the previous store.
- if (Chain.getOpcode() == ISD::STORE && Chain.getOperand(2) == Ptr) {
+ if (Chain.getOpcode() == ISD::STORE && Chain.getOperand(2) == Ptr &&
+ Chain.Val->hasOneUse() /* Avoid introducing DAG cycles */) {
// Create a new store of Value that replaces both stores.
SDNode *PrevStore = Chain.Val;
+ if (PrevStore->getOperand(1) == Value) // Same value multiply stored.
+ return Chain;
SDOperand NewStore = DAG.getNode(ISD::STORE, MVT::Other,
PrevStore->getOperand(0), Value, Ptr,
SrcValue);
+ CombineTo(N, NewStore); // Nuke this store.
CombineTo(PrevStore, NewStore); // Nuke the previous store.
- return NewStore; // Replace this store with NewStore.
+ return SDOperand(N, 0);
}
return SDOperand();
More information about the llvm-commits
mailing list