Skip to content

Commit ace8fa8

Browse files
committed
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.
1 parent ca72c8e commit ace8fa8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cpp/ql/src/semmle/code/cpp/controlflow/Dominance.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ predicate bbIPostDominates(BasicBlock pDom, BasicBlock node) = idominance(bb_exi
126126
* Holds if `dominator` is a strict dominator of `node` in the control-flow
127127
* graph of basic blocks. Being strict means that `dominator != node`.
128128
*/
129+
pragma[nomagic] // magic prevents fastTC
129130
predicate bbStrictlyDominates(BasicBlock dominator, BasicBlock node) {
130131
bbIDominates+(dominator, node)
131132
}

0 commit comments

Comments
 (0)