Introduces a pass that provides default lowering strategy for the
experimental.widenable.condition intrinsic, replacing all its uses with i1 true.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Why not do this as either a) SelectionDAG or b) CodeGenPrepare? I don't see the value in having the separate pass for this.
Because we might want to get rid of widenable conditions (and therefore of guards) not right before codegen, but earlier? For example, before vectorization to get rid of control flow inside a loop.
Max and I discussed offline. We decided on a "let's do both" approach. We want standard codegen to know how to lower guards, but we also want to be able to experiment easily with doing so earlier in the pipeline.
I've posted https://reviews.llvm.org/D56096 which does the same transform in CGP. We could have just scheduled the extra pass, but doing so seemed slightly ugly when CGP would be obviously the right place for this if we didn't also want the option to lower early.
Given that, LGTM.
lib/Transforms/Scalar/LowerWidenableCondition.cpp | ||
---|---|---|
65 ↗ | (On Diff #179539) | At some point down the line, we'll probably want to simplify the CFG here, but that's definitely okay to be a followup. |
lib/Transforms/Scalar/LowerWidenableCondition.cpp | ||
---|---|---|
65 ↗ | (On Diff #179539) | Not sure if it's worth doing. The typical use case is br i1 some_cond & WC, label1, label2; we only have CFG update if we have previously proved that some_cond is trivially true. If it's a frequent situation in practice, we can think about it. |