[PATCH] D62025: Expand llvm.is.constant earlier

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 17:55:30 PDT 2019


chandlerc added a comment.

I think this isn't quite right (if I've understood what it is doing correctly).

We want to fold `llvm.is.constant` to true as early as possible, but to false as late as possible. This pass is the right place to fold early (and often). But it is a very bad place to fold late. The only thing that should fold `llvm.is.constant` to `false` should be FastISel or SelectionDAG.

So you should change the code to *conditionally* fold here instead of unconditionally based on the above.

Then the test needs to show both sides of this, preferably with the specific desired use case of control flow that can be simplified when the intrinsic folds to `true`, and showing it is not simplified prior to inlining, but is simplified after inlining, where the inlining allows the argument to become a constant.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62025





More information about the llvm-commits mailing list