diff options
author | Chris Lattner <sabre@nondot.org> | 2005-10-27 07:10:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-10-27 07:10:34 +0000 |
commit | fe7f046de875e41dd338163a719a32571da7ec06 (patch) | |
tree | 9d3fa48f4d35aa30ba64bca97f85cdb0130a9fc8 | |
parent | 0e026de6ac21540b25dc37fed9f047f159cdca55 (diff) | |
download | external_llvm-fe7f046de875e41dd338163a719a32571da7ec06.zip external_llvm-fe7f046de875e41dd338163a719a32571da7ec06.tar.gz external_llvm-fe7f046de875e41dd338163a719a32571da7ec06.tar.bz2 |
Fix DSE to not nuke dead stores unless they redundant store is the same
VT as the killing one. Fix fixes PR491
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24034 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 30c8d98..412b47e 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1976,7 +1976,10 @@ SDOperand DAGCombiner::visitSTORE(SDNode *N) { // If this is a store that kills a previous store, remove the previous store. if (Chain.getOpcode() == ISD::STORE && Chain.getOperand(2) == Ptr && - Chain.Val->hasOneUse() /* Avoid introducing DAG cycles */) { + Chain.Val->hasOneUse() /* Avoid introducing DAG cycles */ && + // Make sure that these stores are the same value type: + // FIXME: we really care that the second store is >= size of the first. + Value.getValueType() == Chain.getOperand(1).getValueType()) { // Create a new store of Value that replaces both stores. SDNode *PrevStore = Chain.Val; if (PrevStore->getOperand(1) == Value) // Same value multiply stored. |