[llvm] [SimplifyCFG] Don't limit the number of simultaneous forwards from switch condition (PR #95932)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 00:50:11 PDT 2024


zmodem wrote:

(I can't access the alive2 links, the server seems to be down?)

I don't have any strong opinion about whether always "forwarding" the switch condition is right or wrong. I suppose it comes down to what the following passes are best able to handle, and @nikic is probably the right person to answer that.

On the one hand, it seems bad to replace constants with a variable -- that's why 4ab4a8e was conservative and only does it when it's likely to cause blocks to get folded. On the other hand, as you say, it's easy to propagate such constants later.

I do think my diff above would fix your use case? So if we do decide to "always forward" I think we need some motivation, and we should update the comment for `FindPHIForConditionForwarding` with that motivation rather than talk about folding away destination blocks.

https://github.com/llvm/llvm-project/pull/95932


More information about the llvm-commits mailing list