[PATCH] D130769: [RISCV] Combine and remove redundant ADD/SUB instructions

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 07:32:46 PDT 2022


reames added a comment.

In D130769#3730408 <https://reviews.llvm.org/D130769#3730408>, @craig.topper wrote:

> I agree the tests are overly reduced. Based on the description, I think this patch is trying to fix cases where tail duplication duplicates a block that originally contained a phi. This allows duplicated code to end up in the basic block that produced the original incoming value. I've seen this happen where the incoming values are constants. After duplication we end up still putting the constant in a register instead of folding it. I don't think this patch addresses that case though.

That sounds plausible, but the patch itself needs to include this justification (including in reasonable tests).

If this is the use case, it really feels like something tail folding itself should be doing.  Having tail folding run a forward simplify pass over the duplicated tail would seem reasonable.  Not sure we have the right API for that today, but if not, maybe we should.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130769



More information about the llvm-commits mailing list