Skip to content

Commit 527181b

Browse files
committed
C++: Rename CongruentCopyInstructionTotal to LoadTotalOverlapInstruction and extend LoadInstruction instead of CopyInstruction
1 parent ba395cf commit 527181b

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/ValueNumbering.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ newtype TValueNumber =
5252
) {
5353
inheritanceConversionValueNumber(_, irFunc, opcode, baseClass, derivedClass, operand)
5454
} or
55-
TCongruentCopyInstructionTotal(
55+
TLoadTotalOverlapValueNumber(
5656
IRFunction irFunc, IRType type, ValueNumber memOperand, ValueNumber operand
5757
) {
58-
congruentCopyInstructionTotalValueNumber(_, irFunc, type, memOperand, operand)
58+
loadTotalOverlapValueNumber(_, irFunc, type, memOperand, operand)
5959
} or
6060
TUniqueValueNumber(IRFunction irFunc, Instruction instr) { uniqueValueNumber(instr, irFunc) }
6161

@@ -106,14 +106,14 @@ class ValueNumber extends TValueNumber {
106106
* The use of `p.x` on line 3 is linked to the definition of `p` on line 1 as well, but is not
107107
* congruent to that definition because `p.x` accesses only a subset of the memory defined by `p`.
108108
*/
109-
class CongruentCopyInstructionExact extends CopyInstruction {
110-
CongruentCopyInstructionExact() {
109+
class CongruentCopyInstruction extends CopyInstruction {
110+
CongruentCopyInstruction() {
111111
this.getSourceValueOperand().getDefinitionOverlap() instanceof MustExactlyOverlap
112112
}
113113
}
114114

115-
class CongruentCopyInstructionTotal extends CopyInstruction {
116-
CongruentCopyInstructionTotal() {
115+
class LoadTotalOverlapInstruction extends LoadInstruction {
116+
LoadTotalOverlapInstruction() {
117117
this.getSourceValueOperand().getDefinitionOverlap() instanceof MustTotallyOverlap
118118
}
119119
}
@@ -141,9 +141,9 @@ private predicate numberableInstruction(Instruction instr) {
141141
or
142142
instr instanceof PointerArithmeticInstruction
143143
or
144-
instr instanceof CongruentCopyInstructionExact
144+
instr instanceof CongruentCopyInstruction
145145
or
146-
instr instanceof CongruentCopyInstructionTotal
146+
instr instanceof LoadTotalOverlapInstruction
147147
}
148148

149149
private predicate variableAddressValueNumber(
@@ -235,8 +235,8 @@ private predicate inheritanceConversionValueNumber(
235235
valueNumber(instr.getUnary()) = operand
236236
}
237237

238-
private predicate congruentCopyInstructionTotalValueNumber(
239-
CongruentCopyInstructionTotal instr, IRFunction irFunc, IRType type, ValueNumber memOperand,
238+
private predicate loadTotalOverlapValueNumber(
239+
LoadTotalOverlapInstruction instr, IRFunction irFunc, IRType type, ValueNumber memOperand,
240240
ValueNumber operand
241241
) {
242242
instr.getEnclosingIRFunction() = irFunc and
@@ -338,12 +338,12 @@ private ValueNumber nonUniqueValueNumber(Instruction instr) {
338338
)
339339
or
340340
exists(IRType type, ValueNumber memOperand, ValueNumber operand |
341-
congruentCopyInstructionTotalValueNumber(instr, irFunc, type, memOperand, operand) and
342-
result = TCongruentCopyInstructionTotal(irFunc, type, memOperand, operand)
341+
loadTotalOverlapValueNumber(instr, irFunc, type, memOperand, operand) and
342+
result = TLoadTotalOverlapValueNumber(irFunc, type, memOperand, operand)
343343
)
344344
or
345345
// The value number of a copy is just the value number of its source value.
346-
result = valueNumber(instr.(CongruentCopyInstructionExact).getSourceValue())
346+
result = valueNumber(instr.(CongruentCopyInstruction).getSourceValue())
347347
)
348348
)
349349
}

0 commit comments

Comments
 (0)