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

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 18:06:39 PDT 2019


chandlerc added a comment.

Joerg points out in IRC that we need control flow pruning to be symmetric w/ `true` and `false`.

In that case, I think we need `SelectionDAG` and `FastISel` to *reject* lowering `llvm.is.constant` and add a dedicated lowering pass like we have for lowering atomics. It is needed for the exact same reason as atomics -- to do control flow cleanup after folding these to false.

That pass should be a dedicated pass IMO that *only* folds these intrinsics, and then *only* remove dead code. I don't think this should happen inside another pass or rely on SimplifyCFG (which does way too much). And it should be a codegen pass over the IR, not part of the pass pipeline.

These should, of course, be two separate patches -- one to get early folding to `true`, and one to hoist the remainder out of ISel and into a pass that can prune the CFG.


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