[PATCH] D152116: [DAGCombiner] Transform `(icmp eq/ne (and X,C0),(shift X,C1))` to use rotate or to getter constants.

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 10:59:28 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/TargetLowering.h:818
+  // If ShiftOpc (current Opcode) is returned, do nothing.
+  virtual unsigned preferedOpcodeForCmpEqOperandPieces(
+      EVT VT, unsigned ShiftOpc, bool MayTransformRotate,
----------------
RKSimon wrote:
> This function name seems very general and yet the transform seems very specific.
Changed to "PiecesOfOperand" hopefully thats clearer. Otherwise, what would you suggest. "OperandPieces" is mean to refer to the fact that this for comparisons where we are comparing a part of X with another part of X (i.e (X & 255) == (X >> 8)` is comparing that the top 8bits (one piece) equals the low 8bits (another piece).


================
Comment at: llvm/include/llvm/CodeGen/TargetLowering.h:819
+  virtual unsigned preferedOpcodeForCmpEqOperandPieces(
+      EVT VT, unsigned ShiftOpc, bool MayTransformRotate,
+      const APInt &ShiftOrRotateAmt,
----------------
RKSimon wrote:
> Maybe EVT /*VT*/ style would be better than all the (void) ?
What is EVT /*VT*/ style?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152116/new/

https://reviews.llvm.org/D152116



More information about the llvm-commits mailing list