Skip to content

Commit ecfc536

Browse files
committed
C++: IR: InstructionSanity::duplicateOperand perf
The `InstructionSanity::duplicateOperand` predicate used `count` instead of `strictcount`. The 0-case of this `count` was as large as the Cartesian product of `Instruction` and `OperandTag`, which made `duplicateOperand` take forever to compute on large snapshots.
1 parent b6b3581 commit ecfc536

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module InstructionSanity {
6363
* Holds if instruction `instr` has multiple operands with tag `tag`.
6464
*/
6565
query predicate duplicateOperand(Instruction instr, OperandTag tag) {
66-
count(instr.getOperand(tag)) > 1 and
66+
strictcount(instr.getOperand(tag)) > 1 and
6767
not tag instanceof UnmodeledUseOperand
6868
}
6969

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module InstructionSanity {
6363
* Holds if instruction `instr` has multiple operands with tag `tag`.
6464
*/
6565
query predicate duplicateOperand(Instruction instr, OperandTag tag) {
66-
count(instr.getOperand(tag)) > 1 and
66+
strictcount(instr.getOperand(tag)) > 1 and
6767
not tag instanceof UnmodeledUseOperand
6868
}
6969

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module InstructionSanity {
6363
* Holds if instruction `instr` has multiple operands with tag `tag`.
6464
*/
6565
query predicate duplicateOperand(Instruction instr, OperandTag tag) {
66-
count(instr.getOperand(tag)) > 1 and
66+
strictcount(instr.getOperand(tag)) > 1 and
6767
not tag instanceof UnmodeledUseOperand
6868
}
6969

0 commit comments

Comments
 (0)