Skip to content

Commit 60bcbf4

Browse files
committed
C++: pragma[noinline] on GVN charpred
The charpred of class `GVN` in `ASTValueNumbering.qll` got inlined into the member predicate `getAnInstruction` and caused a tuple explosion on Wireshark in the query `StrncpyFlippedArgs.ql`. I interrupted the predicate after 10 minutes and got these intermediate tuple counts: (5208s) Tuple counts for ASTValueNumbering::GVN::getAnInstruction_dispred#ff: 8754900909 ~5% {3} r1 = JOIN ValueNumberingInternal::tvalueNumber#ff_10#join_rhs AS L WITH ValueNumberingInternal::tvalueNumber#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, L.<1>, L.<0> 4390274632 ~150085% {2} r2 = JOIN r1 WITH project#SSAConstruction::Cached::getInstructionUnconvertedResultExpression AS R ON FIRST 1 OUTPUT r1.<2>, r1.<1> return r2 After this change, the `getAnInstruction` predicate is itself inlined, like it should be. The new non-inlined charpred takes 2.1s and has these tuple counts: (2s) Tuple counts for ASTValueNumbering::GVN#f: 9158442 ~117% {1} r1 = JOIN project#SSAConstruction::Cached::getInstructionUnconvertedResultExpression AS L WITH ValueNumberingInternal::tvalueNumber#ff@staged_ext AS R ON FIRST 1 OUTPUT R.<1> return r1
1 parent 88c74b2 commit 60bcbf4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cpp/ql/src/semmle/code/cpp/ir/internal/ASTValueNumbering.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ private import semmle.code.cpp.ir.IR
5151
* methods.
5252
*/
5353
class GVN extends TValueNumber {
54+
pragma[noinline]
5455
GVN() {
5556
exists(Instruction instr |
5657
this = tvalueNumber(instr) and exists(instr.getUnconvertedResultExpression())

0 commit comments

Comments
 (0)