[PATCH] D70079: [SelectionDAG] Combine U{ADD,SUB}O diamonds into {ADD,SUB}CARRY

Paweł Bylica via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 20 08:55:58 PST 2022


chfast added a comment.
Herald added subscribers: ecnelises, pengfei.

I have found one case not covered by this case: in case of subtraction when we only care about the final carry bit (the difference is discarded) the first subtraction will be to compare. So here we may want to also search for `cmp`. I did a prototype by duplicating this code and modifying in for the `cmp` case only it this works. But I'm not sure if mixing it all here will be good idea. Anyway, I wanted to reach out about it and maybe fix the TODO from this patch in the mean time.



================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2864
+  // Verify that the carry/borrow in is plausibly a carry/borrow bit.
+  // TODO: make getAsCarry() aware of how partial carries are merged.
+  if (CarryIn.getOpcode() != ISD::ZERO_EXTEND)
----------------
Do you remember this TODO here? I'd like to fix it if you can provide more details about it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70079



More information about the llvm-commits mailing list