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

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


chandlerc added a comment.

In D62025#1533406 <https://reviews.llvm.org/D62025#1533406>, @chandlerc wrote:

> 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.


On further thought, I think it's worth putting this into the main IR pass set, and just adding it in the codegen passes like the atomic lowering pass. But we might want to *additionally* add it to the pass pipeline right after inlining finishes (for the last time in LTO, a really important case). That way we can avoid confusing the vectorizer and LSR with this kind of control flow.


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