[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Chris Lattner
clattner at apple.com
Mon Apr 30 21:39:37 PDT 2007
> + 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);
This can never trigger and isn't right if it did.
#1: This should trigger if the chain has uses but the other values do
not. If the entire node is dead, it will already have been removed.
#2. you can't create an undef with multiple results, you have to
create multiple undefs :)
I'd suggest just writing this as:
if (N->getValueType(1) == MVT::Other) {
// single result case.
} else {
assert(N->getValueType(2) == MVT::Other);
// multi result case.
}
This lets you drop the looping and smallvector.
-Chris
More information about the llvm-commits
mailing list