[PATCH] D111777: [GlobalISel] Refactor CSEMIRBuilder's handling of unary op constant folding. NFC.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 13:49:27 PDT 2021


arsenm added a comment.

In D111777#3066274 <https://reviews.llvm.org/D111777#3066274>, @foad wrote:

> No particular objection from me, though it would be more consistent if ConstantFoldUnaryOp built the G_CONSTANT, just like ConstantFoldVectorUnaryOp builds the G_BUILD_VECTOR.
>
> That then raises the question of how you would call these functions from CombinerHelper match* functions, which don't want to build the IR until you get to the corresponding apply* function.
>
> That then also raises the question of whether we really want to be doing constant folding both in the builder and in combiners.

I think the answer is yes, but for different reasons. I think constant folding in the builder only makes sense for handful of artifact-like operations, but general constant folding is always going to be needed in the combiners as other operations fold to constants


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111777



More information about the llvm-commits mailing list