Skip to content

Commit ac16993

Browse files
author
Dave Bartolomeo
committed
C++/C#: More efficient evaluation of SSA::hasInstruction()
1 parent 4331b9b commit ac16993

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ private module Cached {
5151

5252
cached
5353
predicate hasInstruction(TStageInstruction instr) {
54-
instr instanceof TRawInstruction implies instr instanceof OldInstruction
54+
instr instanceof TRawInstruction and instr instanceof OldInstruction
55+
or
56+
instr instanceof TPhiInstruction
57+
or
58+
instr instanceof TChiInstruction
59+
or
60+
instr instanceof TUnreachedInstruction
5561
}
5662

5763
private IRBlock getNewBlock(OldBlock oldBlock) {

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ private module Cached {
5151

5252
cached
5353
predicate hasInstruction(TStageInstruction instr) {
54-
instr instanceof TRawInstruction implies instr instanceof OldInstruction
54+
instr instanceof TRawInstruction and instr instanceof OldInstruction
55+
or
56+
instr instanceof TPhiInstruction
57+
or
58+
instr instanceof TChiInstruction
59+
or
60+
instr instanceof TUnreachedInstruction
5561
}
5662

5763
private IRBlock getNewBlock(OldBlock oldBlock) {

csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ private module Cached {
5151

5252
cached
5353
predicate hasInstruction(TStageInstruction instr) {
54-
instr instanceof TRawInstruction implies instr instanceof OldInstruction
54+
instr instanceof TRawInstruction and instr instanceof OldInstruction
55+
or
56+
instr instanceof TPhiInstruction
57+
or
58+
instr instanceof TChiInstruction
59+
or
60+
instr instanceof TUnreachedInstruction
5561
}
5662

5763
private IRBlock getNewBlock(OldBlock oldBlock) {

0 commit comments

Comments
 (0)