[llvm] [SimplifyCFG] Simplify conditional branches on const icmp eq's (PR #73334)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 24 07:17:22 PST 2023
yonillasky wrote:
> What is the broader motivation for this? That is, why is it important to handle this within a single SimplifyCFG invocation? We'd probably want to have a PhaseOrdering test for that.
Pay close attention to the test. To fully simplify the test case with existing code you'd need to run SimplifyCFG first, then a pass that folds constants, then SimplifyCFG again.
That, to me, seemed unreasonable - hence the PR.
> I'm not entirely sure whether this is the best approach. A possible alternative would be to instead perform additional simplification when removing the unreachable block and simplifying the phi to a constant. We could try to simplify all instructions that used the phi at that point.
I like the idea. However, how about specifically attempting to constant-fold the successor's BranchInst condition, if it has one, then?
I'm making this counter-offer since I'm not sure the CFG simplification pass should be also doing constant-folding in unrelated instructions.
https://github.com/llvm/llvm-project/pull/73334
More information about the llvm-commits
mailing list