X Tutup
The Wayback Machine - https://web.archive.org/web/20240114023205/https://github.com/github/codeql/pull/15316
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking 鈥淪ign up for GitHub鈥, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++: Make IR generation robust against functions with many declaring types #15316

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MathiasVP
Copy link
Contributor

@MathiasVP MathiasVP commented Jan 12, 2024

When we merged #12125 we started seeing a few (templated) member functions with many 1000s of (templated) declaring types.

We use the type of the declaring function to infer the result type of a write side effect on the qualifier of a member function call. And when there are N declaring types for a member function call, the write side effect has N result types 馃槺. This causes massive slowdowns in the IR alias analysis.

This PR changes the IR generation of these write side effect instructions so that we return an "unknown type" rather than a large number of types if we're ever in a situation where there are more than 10 declaring types.

I picked 10 rather arbitrarily as the project I was testing this on had cases where there were 6 declaring types even before we merged #12125.

I haven't been able to reproduce this in a test, but on a project that exhibited this performance problem I'm seeing a difference in the output of PrintIR: https://www.diffchecker.com/CQ6UH8IN/

鈥ore than 10 types. If it has more than 10 types we generate an unknown type.
@github-actions github-actions bot added the C++ label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant
X Tutup