[PATCH] D27916: [RFC]Make the canonicalisation on shifts benifit to more case.

Renato Golin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 08:35:00 PST 2016


rengolin added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4557
+      !isa<ConstantSDNode>(BinOpLHSVal->getOperand(1))) &&
+       BinOpLHSVal->getOpcode() != ISD::CopyFromReg &&
+       BinOpLHSVal->getOpcode() != ISD::SELECT)
----------------
This `if` is getting a bit bloated. I think we should create a few boolean variables with names.

Something like:

    auto Opc = BinOpLHSVal->getOpcode();
    bool isShift = (Opc == ISD::SHL ...);
    bool isConstantOp = isa<ConstantSDNode>(BinOpLHSVal->getOperand(1);
    bool isCopyOrSelect = (Opc == ISD::CopyFromReg ...);
    
    if ((!isShift || !isConstantOp) && !isCopyOrSelect)
      ...



https://reviews.llvm.org/D27916





More information about the llvm-commits mailing list