The `ValueNumbering` library is supposed to propagate value numberings through a `CopyInstruction` only when it's _congruent_, meaning it must have exact overlap with its source. A `CopyInstruction` can be a `LoadInstruction`, a `StoreInstruction`, or a `CopyValueInstruction`. The latter is also a `UnaryInstruction`, and the value numbering rule for `UnaryInstruction` applied to it as well. This meant that value numbering would propagate even through a non-congruent `CopyValueInstruction`. That's semantically wrong but probably only an issue in very rare circumstances, and it should get corrected when we change the definition of `getUnary` to require congruence. What's worse is the performance implications. It meant that the value numbering IPA witness could take two different paths through every `CopyValueInstruction`. If multiple `CopyValueInstruction`s were chained, this would lead to an exponential number of variable numbers for the same `Instruction`, and we would run out of time and space while performing value numbering. This fixes the performance of `ValueNumbering.qll` on https://github.com/asterisk/asterisk, although this project might also require a separate change for fixing an infinite loop in the IR constant analysis.
Semmle QL
This open source repository contains the standard QL libraries and queries that power LGTM, and the other products that Semmle makes available to its customers worldwide.
How do I learn QL and run queries?
There is extensive documentation on getting started with writing QL. You can use the interactive query console on LGTM.com or the QL for Eclipse plugin to try out your queries on any open-source project that's currently being analyzed.
Contributing
We welcome contributions to our standard library and standard checks. Do you have an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request! Before you do, though, please take the time to read our contributing guidelines. You can also consult our style guides to learn how to format your QL for consistency and clarity, how to write query metadata, and how to write query help documentation for your query.
License
The QL queries in this repository are licensed under Apache License 2.0 by Semmle.