Skip to content

Commit e0c0733

Browse files
committed
C++: Remove CP in getOperandMemoryAccess
The overrides of `Instruction.getOperandMemoryAccess` did not relate `this` to any of its other parameters, which made it attempt to compute the Cartesian product of `Instruction` and `TPhiOperand`. This happened only during computation of aliased SSA. Perhaps the optimizer was able to eliminate the CP for the non-aliased SSA computation. With this change, I'm able to compute aliased SSA for medium-sized snapshots.
1 parent 1bcae97 commit e0c0733

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ class ReturnValueInstruction extends ReturnInstruction {
602602
}
603603

604604
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
605-
tag instanceof ReturnValueOperand and
605+
exists(this.getOperand(tag.(ReturnValueOperand))) and
606606
result instanceof IndirectMemoryAccess
607607
}
608608
}
@@ -629,7 +629,7 @@ class LoadInstruction extends CopyInstruction {
629629
}
630630

631631
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
632-
tag instanceof CopySourceOperand and
632+
exists(this.getOperand(tag.(CopySourceOperand))) and
633633
result instanceof IndirectMemoryAccess
634634
}
635635

@@ -1015,7 +1015,7 @@ class ThrowValueInstruction extends ThrowInstruction {
10151015
}
10161016

10171017
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
1018-
tag instanceof ExceptionOperand and
1018+
exists(this.getOperand(tag.(ExceptionOperand))) and
10191019
result instanceof IndirectMemoryAccess
10201020
}
10211021

@@ -1114,7 +1114,7 @@ class UnmodeledUseInstruction extends Instruction {
11141114
}
11151115

11161116
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
1117-
tag instanceof UnmodeledUseOperand and
1117+
exists(this.getOperand(tag.(UnmodeledUseOperand))) and
11181118
result instanceof UnmodeledMemoryAccess
11191119
}
11201120
}
@@ -1125,7 +1125,7 @@ class PhiInstruction extends Instruction {
11251125
}
11261126

11271127
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
1128-
tag instanceof PhiOperand and
1128+
exists(this.getOperand(tag.(PhiOperand))) and
11291129
result instanceof PhiMemoryAccess
11301130
}
11311131

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ class ReturnValueInstruction extends ReturnInstruction {
602602
}
603603

604604
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
605-
tag instanceof ReturnValueOperand and
605+
exists(this.getOperand(tag.(ReturnValueOperand))) and
606606
result instanceof IndirectMemoryAccess
607607
}
608608
}
@@ -629,7 +629,7 @@ class LoadInstruction extends CopyInstruction {
629629
}
630630

631631
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
632-
tag instanceof CopySourceOperand and
632+
exists(this.getOperand(tag.(CopySourceOperand))) and
633633
result instanceof IndirectMemoryAccess
634634
}
635635

@@ -1015,7 +1015,7 @@ class ThrowValueInstruction extends ThrowInstruction {
10151015
}
10161016

10171017
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
1018-
tag instanceof ExceptionOperand and
1018+
exists(this.getOperand(tag.(ExceptionOperand))) and
10191019
result instanceof IndirectMemoryAccess
10201020
}
10211021

@@ -1114,7 +1114,7 @@ class UnmodeledUseInstruction extends Instruction {
11141114
}
11151115

11161116
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
1117-
tag instanceof UnmodeledUseOperand and
1117+
exists(this.getOperand(tag.(UnmodeledUseOperand))) and
11181118
result instanceof UnmodeledMemoryAccess
11191119
}
11201120
}
@@ -1125,7 +1125,7 @@ class PhiInstruction extends Instruction {
11251125
}
11261126

11271127
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
1128-
tag instanceof PhiOperand and
1128+
exists(this.getOperand(tag.(PhiOperand))) and
11291129
result instanceof PhiMemoryAccess
11301130
}
11311131

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ class ReturnValueInstruction extends ReturnInstruction {
602602
}
603603

604604
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
605-
tag instanceof ReturnValueOperand and
605+
exists(this.getOperand(tag.(ReturnValueOperand))) and
606606
result instanceof IndirectMemoryAccess
607607
}
608608
}
@@ -629,7 +629,7 @@ class LoadInstruction extends CopyInstruction {
629629
}
630630

631631
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
632-
tag instanceof CopySourceOperand and
632+
exists(this.getOperand(tag.(CopySourceOperand))) and
633633
result instanceof IndirectMemoryAccess
634634
}
635635

@@ -1015,7 +1015,7 @@ class ThrowValueInstruction extends ThrowInstruction {
10151015
}
10161016

10171017
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
1018-
tag instanceof ExceptionOperand and
1018+
exists(this.getOperand(tag.(ExceptionOperand))) and
10191019
result instanceof IndirectMemoryAccess
10201020
}
10211021

@@ -1114,7 +1114,7 @@ class UnmodeledUseInstruction extends Instruction {
11141114
}
11151115

11161116
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
1117-
tag instanceof UnmodeledUseOperand and
1117+
exists(this.getOperand(tag.(UnmodeledUseOperand))) and
11181118
result instanceof UnmodeledMemoryAccess
11191119
}
11201120
}
@@ -1125,7 +1125,7 @@ class PhiInstruction extends Instruction {
11251125
}
11261126

11271127
override final MemoryAccessKind getOperandMemoryAccess(OperandTag tag) {
1128-
tag instanceof PhiOperand and
1128+
exists(this.getOperand(tag.(PhiOperand))) and
11291129
result instanceof PhiMemoryAccess
11301130
}
11311131

0 commit comments

Comments
 (0)