[llvm] [CVP] Check whether the default case is reachable (PR #79993)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 16 12:32:00 PST 2024


topperc wrote:

I'm also seeing an issue from this patch. I have a switch with all values 0-126 and a default. All 128 cases jump to basic blocks that contain a branch to a common merge point. The common merge point contains a phi that picks a constant based on how it was reached. I believe this constant is the original switch value + 5. Except for the default case which is 0. This makes it a candidate for `LinearMapKind` in SimplifyCFG's SwitchLookupTable::BuildLookup.

This patch determines the default case is unreachable. Somehow that allowed jump threading to thread case 126. This prevented SimplifyCFG from doing the lookup table conversion.

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


More information about the llvm-commits mailing list