[PATCH] D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588)

Douglas Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 9 20:21:58 PST 2022


dougpuob marked an inline comment as done.
dougpuob added inline comments.


================
Comment at: llvm/lib/Target/M68k/M68kISelDAGToDAG.cpp:326
+    case ISD::SUB: {
+      SDNode *Dividend = U->getOperand(0).getNode();
+      if (ConstantSDNode *CSDN = dyn_cast<ConstantSDNode>(Dividend))
----------------
RKSimon wrote:
> Any reason why you can't just use llvm::isNullConstant(U->getOperand(0)) ?
Thank you for the reminder. It makes the code cleaner.


================
Comment at: llvm/test/CodeGen/M68k/Arith/imul-neg.ll:4
 
 define i32 @mul4294967295_32(i32 %A) {
 ; CHECK-LABEL: mul4294967295_32:
----------------
RKSimon wrote:
> Should we have i16/i8 test coverage as well?
Sure. Increase test coverage is good.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116886



More information about the llvm-commits mailing list