Skip to content

Commit eed24f1

Browse files
committed
C++: Improve join orders with QL CFG
Size estimates are slightly different when we enable the QL CFG, and this caused bad join orders in these predicates.
1 parent e048207 commit eed24f1

File tree

1 file changed

+4
-3
lines changed
  • cpp/ql/src/semmle/code/cpp/dataflow/internal

1 file changed

+4
-3
lines changed

cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ module FlowVar_internal {
490490
exists(VariableAccess va |
491491
va.getTarget() = result and
492492
readAccess(va) and
493-
bbNotInLoop(va.getBasicBlock())
493+
exists(BasicBlock bb | bb = va.getBasicBlock() | not this.bbInLoop(bb))
494494
)
495495
}
496496

@@ -679,10 +679,11 @@ module FlowVar_internal {
679679
predicate dominatedByOverwrite(UninitializedLocalVariable v, VariableAccess va) {
680680
exists(BasicBlock bb, int vaIndex |
681681
va = bb.getNode(vaIndex) and
682-
va.getTarget() = v
683-
|
682+
va.getTarget() = v and
684683
vaIndex > indexOfFirstOverwriteInBB(v, bb)
685684
or
685+
va = bb.getNode(vaIndex) and
686+
va.getTarget() = v and
686687
bbStrictlyDominates(getAnOverwritingBB(v), bb)
687688
)
688689
}

0 commit comments

Comments
 (0)