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

Quentin Dian via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 05:43:43 PST 2024


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

This example will make the problem more obvious than the two switch statements. I'll create an issue that using a small case and link back to this one.

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

Yeah, I often see commits being reverted. :)


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


More information about the llvm-commits mailing list