[PATCH] D144116: [DAGCombiner] Avoid converting (x or/xor const) + y to (x + y) + const if benefit is unclear

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 00:56:04 PST 2023


dmgreen added a comment.

Would it be possible to optimize the ADDCARRY to the same result as without this fold? Similar to combineADDCARRYDiamond. I looked at the DAG that was being produced, but it's not obvious to me how it would be sensible combined to the same result as before.

I added the fold really to handle cases like this, which can often come up after lowering geps:

  or x1, x1, #1
  add x1, x1, x2
  ldr x0, [x1]

Which can be transformed into

  add x1, x1, x2
  ldr x0, [x1, #1]

If the add+add is reassociated, it makes sense for the add+add-like-or to be reassociated. I have no objections to limiting the fold if we need to though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144116



More information about the llvm-commits mailing list