From ecfc53668ff8dd10f0e0d34bb6f23b67c003958a Mon Sep 17 00:00:00 2001 From: Jonas Jensen Date: Tue, 11 Sep 2018 12:00:42 +0200 Subject: [PATCH] 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. --- .../code/cpp/ir/implementation/aliased_ssa/Instruction.qll | 2 +- .../src/semmle/code/cpp/ir/implementation/raw/Instruction.qll | 2 +- .../code/cpp/ir/implementation/unaliased_ssa/Instruction.qll | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll index 660c4ac3c9c6..3d27026e3d02 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll @@ -63,7 +63,7 @@ module InstructionSanity { * Holds if instruction `instr` has multiple operands with tag `tag`. */ query predicate duplicateOperand(Instruction instr, OperandTag tag) { - count(instr.getOperand(tag)) > 1 and + strictcount(instr.getOperand(tag)) > 1 and not tag instanceof UnmodeledUseOperand } diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll index 660c4ac3c9c6..3d27026e3d02 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll @@ -63,7 +63,7 @@ module InstructionSanity { * Holds if instruction `instr` has multiple operands with tag `tag`. */ query predicate duplicateOperand(Instruction instr, OperandTag tag) { - count(instr.getOperand(tag)) > 1 and + strictcount(instr.getOperand(tag)) > 1 and not tag instanceof UnmodeledUseOperand } diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll index 660c4ac3c9c6..3d27026e3d02 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll @@ -63,7 +63,7 @@ module InstructionSanity { * Holds if instruction `instr` has multiple operands with tag `tag`. */ query predicate duplicateOperand(Instruction instr, OperandTag tag) { - count(instr.getOperand(tag)) > 1 and + strictcount(instr.getOperand(tag)) > 1 and not tag instanceof UnmodeledUseOperand }