diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2024-04-15 16:24:39 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-04-15 16:30:29 +0000 |
commit | 514c98ba14a0f590891844d1a6bec0ac4de54489 (patch) | |
tree | 91c622c1a34d4ddbb2286cc32d4d5532385d30d1 /contrib | |
parent | 21761f2ede4ebad13e78112b9409c1f20f946781 (diff) | |
download | src-514c98ba14a0f590891844d1a6bec0ac4de54489.tar.gz src-514c98ba14a0f590891844d1a6bec0ac4de54489.zip |
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 13eae549b2ce..f95dae1842fe 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -6710,9 +6710,11 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder, return SwitchLookupTable::WouldFitInRegister( DL, UpperBound, KV.second /* ResultType */); })) { + // There may be some case index larger than the UpperBound (unreachable + // case), so make sure the table size does not get smaller. + TableSize = std::max(UpperBound, TableSize); // The default branch is unreachable after we enlarge the lookup table. // Adjust DefaultIsReachable to reuse code path. - TableSize = UpperBound; DefaultIsReachable = false; } } |