mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
C++: pragma[nomagic] on bbStrictlyDominates
I noticed that queries using the data flow library spent significant time in `#Dominance::bbIDominates#fbPlus`, which is the body of the `bbStrictlyDominates` predicate. That predicate took 28 seconds to compute on Wireshark. The `b` in the predicate name means that magic was applied, and the application of magic meant that it could not be evaluated with the built-in `fastTC` HOP but became an explicit recursion instead. Applying `pragma[nomagic]` to this predicate means that we will always get it evaluated with `fastTC`, and that takes less than a second in my test case.
This commit is contained in:
@@ -126,6 +126,7 @@ predicate bbIPostDominates(BasicBlock pDom, BasicBlock node) = idominance(bb_exi
|
||||
* Holds if `dominator` is a strict dominator of `node` in the control-flow
|
||||
* graph of basic blocks. Being strict means that `dominator != node`.
|
||||
*/
|
||||
pragma[nomagic] // magic prevents fastTC
|
||||
predicate bbStrictlyDominates(BasicBlock dominator, BasicBlock node) {
|
||||
bbIDominates+(dominator, node)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user