LegalizeDAG Error?

The LegalizeDAG.cpp file has this code in SelectionDAGLegalize::PromoteNode:

  case ISD::BSWAP: {
    unsigned DiffBits = NVT.getSizeInBits() - OVT.getSizeInBits();
    Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, dl, NVT, Tmp1);
    Tmp1 = DAG.getNode(ISD::BSWAP, dl, NVT, Tmp1);
    Tmp1 = DAG.getNode(ISD::SRL, dl, NVT, Tmp1,
                       DAG.getConstant(DiffBits, TLI.getShiftAmountTy()));

Notice the first DAG.getNode() call. It's using "Tmp1", which at this point isn't initialized. What should it be instead?


Node->getOperand(0) , probably, try it. Nice catch.

Sounds reasonable to me. I'll check in the change. :slight_smile: