mirror of
https://github.com/opnsense/src.git
synced 2026-06-04 22:32:43 -04:00
Merge commit 37b7207651b4 from llvm-project (by zhongyunde@huawei.com):
[SimplifyCFG] Fix crash when there is unreachable large index (#88616)
The large case index out of scope is dead code, but it is still be
created for TableContents in SwitchLookupTable::SwitchLookupTable,
so make sure the table size after growing should not get smaller.
Fix https://github.com/llvm/llvm-project/issues/88607
This should fix "Assertion failed: (idx < size()), function operator[]"
when building the science/dynare port.
PR: 276104, 278320
Reported by: yuri
MFC after: 1 month
(cherry picked from commit 514c98ba14)
This commit is contained in:
parent
18590ac4f0
commit
40d5cf3f39
1 changed files with 3 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue