mirror of
https://github.com/github/codeql.git
synced 2025-12-20 18:56:32 +01:00
There were two problems here. 1. The inline predicates `isInitialized` and `isValueInitialized` on `ArrayAggregateLiteral` caused their callers to materialize every `int` that was a valid index into the array. This was slow on huge value-initialized arrays. 2. The `isInitialized` predicate was used in the `TInstructionTag` IPA type, creating a numbered tuple for each integer in it. This seemed to be entirely unnecessary since the `TranslatedElement`s using those tags were already indexed appropriately.
14 lines
281 B
C++
14 lines
281 B
C++
// This test ensures that we can efficiently generate IR for a large
|
|
// value-initialized array.
|
|
|
|
struct Big {
|
|
char buffer[1 << 30]; // 1 GiB
|
|
Big() : buffer() {} // This explicit init of `buffer` makes it value-initialized
|
|
};
|
|
|
|
int main() {
|
|
Big *big = new Big;
|
|
|
|
return 0;
|
|
}
|