Commit 28d8e8f
Use array comprehension for large byte_extract lowering
lower_byte_extract_array_vector expands byte_extract of an array
type into an element-by-element array_exprt. For large arrays
(e.g., char[100000] in a union), this creates N sub-expressions
that are each recursively lowered and simplified, resulting in
O(N^2) behavior.
When the array size exceeds MAX_FLATTENED_ARRAY_SIZE (1000), use
array_comprehension_exprt instead. This path already exists for
arrays with non-constant size; now it is also used for large
constant-size arrays. This reduces the lowering from O(N)
expressions to O(1).
Performance on union_large_array (char[100000] in a union):
Before: >120s with --arrays-uf-always
After: 2.3s with --arrays-uf-always
Remove thorough-arrays-uf-always tag from union_large_array.desc
since the test now completes in 2 seconds.
Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>1 parent 7ff43f7 commit 28d8e8f
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
1112 | 1113 | | |
1113 | 1114 | | |
1114 | 1115 | | |
1115 | | - | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
1116 | 1123 | | |
1117 | 1124 | | |
1118 | 1125 | | |
| |||
0 commit comments