Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.296 -> 1.297 --- Log message: * Only turn a load to UNDEF if all of its outputs have no uses (indexed loads produce two results.) * Do not touch volatile loads. --- Diffs of the changes: (+20 -5) DAGCombiner.cpp | 25 ++++++++++++++++++++----- 1 files changed, 20 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.296 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.297 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.296 Sun Apr 22 18:15:30 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Apr 30 19:38:21 2007 @@ -3326,11 +3326,26 @@ LoadSDNode *LD = cast<LoadSDNode>(N); SDOperand Chain = LD->getChain(); SDOperand Ptr = LD->getBasePtr(); - - // If there are no uses of the loaded value, change uses of the chain value - // into uses of the chain input (i.e. delete the dead load). - if (N->hasNUsesOfValue(0, 0)) - return CombineTo(N, DAG.getNode(ISD::UNDEF, N->getValueType(0)), Chain); + + // If load is not volatile and there are no uses of the loaded value (and + // the updated indexed value in case of indexed loads), change uses of the + // chain value into uses of the chain input (i.e. delete the dead load). + if (!LD->isVolatile()) { + bool HasUses = false; + SmallVector<MVT::ValueType, 2> VTs; + for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) { + if (!N->hasNUsesOfValue(0, i)) { + HasUses = true; + break; + } + VTs.push_back(N->getValueType(i)); + } + if (!HasUses) { + SmallVector<SDOperand, 1> Ops; + return CombineTo(N, DAG.getNode(ISD::UNDEF, &VTs[0], VTs.size(), 0, 0), + Chain); + } + } // If this load is directly stored, replace the load value with the stored // value. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits