[llvm] [SimplifyCFG] When only one case value is missing, replace default with that case (PR #76669)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 12:54:32 PST 2024


dwblaikie wrote:

> > [oom_manual.cc.txt](https://github.com/llvm/llvm-project/files/13956612/oom_manual.cc.txt)
> 
> I think this example could probably be reduced to two switch statements.

Certainly plausible - I tried my best to reduce it as much as possible with both automatic and manual reduction - but no doubt there's more that could be done (yeah, didn't try merging the switches to just make larger switches) & I'd set my boundary at 10x memory usage, so the problem probably occurs at smaller amounts - but wanted to make sure something that made the issue clear/wasn't only marginally problematic.

>  (Perhaps there are multiple issues here.) I can also manually change the default branch to unreachable to reproduce in clang 17.

Yeah, since this wasn't in the area you changed, it's presumably a case where this change caused some IR that tickles an existing problem in another pass (tail deduplication) - so, yeah, that it's reachable before your change through other codepaths sounds plausible/believable too. But causing the problem to show up more often might be enough reason to hold off on this change until the follow-on issue might be resolved or at least worked around.

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


More information about the llvm-commits mailing list