-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Fix SignedOverflowCheck.ql performance #2404
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 “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The `SignedOverflowCheck.ql` query was very slow on certain snapshots (jluttine/suitesparse and Chromium) due to bad magic in `MacroInvocation::getAnAffectedElement_dispred#fb`. This commit doesn't fix the bad magic but changes the exclusion mechanism to use a predicate where we can better control the magic and optimization. The query should also give more good results due to this new exclusion mechanism, which is the same one used in its sibling, `PointerOverflow.ql`.
This fixes the performance of `SignedOverflowCheck.ql` on jluttine/suitesparse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, and produces the promised speedup.
I'm seeing new results affected by macros on FFmpeg/FFmpeg and libretro/mame2003-plus-libretro, however. Compare https://lgtm.com/query/2133993824516378217/ (before) with https://lgtm.com/query/1000398469093303802/ (after).
This fixes a failing qltest and makes the exclusion similar to what's in `PointerOverflow.ql`. It's possible we should exclude based on both `+` and `<`, but we can revisit that if false positives show up.
https://lgtm.com/query/8781856674325036692/ shows that the FFmpeg FPs go away after |
I've just started https://lgtm.com/query/9140037359670573854/ to test matching end locations instead of start locations. |
This should fix a FP in libretro/mame2003-plus-libretro.
I've pushed an attempted fix, but I haven't verified it yet. I'll follow up later. |
The new results LGTM: the FPs in both FFmpeg and MAME are gone. I hope you also find the QL code to be less strange. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and is behaving.
See commit messages.