Skip to content

Commit 76f2c6a

Browse files
committed
C++: Remove the IRFunction column from the TUniqueValueNumber branch. The next commits will protect the recursion from instructions which has multiple IRFunctions and assign such instructions a unique value number so it won't make sense for them to have an IRFunction column.
1 parent c5e5b8a commit 76f2c6a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/internal/ValueNumberingInternal.qll

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ newtype TValueNumber =
4141
) {
4242
loadTotalOverlapValueNumber(_, irFunc, type, memOperand, operand)
4343
} or
44-
TUniqueValueNumber(IRFunction irFunc, Instruction instr) { uniqueValueNumber(instr, irFunc) }
44+
TUniqueValueNumber(Instruction instr) { uniqueValueNumber(instr) }
4545

4646
/**
4747
* A `ConvertInstruction` which converts data of type `T` to data of type `U`
@@ -277,8 +277,7 @@ private predicate loadTotalOverlapValueNumber(
277277
* Holds if `instr` should be assigned a unique value number because this library does not know how
278278
* to determine if two instances of that instruction are equivalent.
279279
*/
280-
private predicate uniqueValueNumber(Instruction instr, IRFunction irFunc) {
281-
instr.getEnclosingIRFunction() = irFunc and
280+
private predicate uniqueValueNumber(Instruction instr) {
282281
not instr.getResultIRType() instanceof IRVoidType and
283282
(
284283
not numberableInstruction(instr)
@@ -294,10 +293,8 @@ cached
294293
TValueNumber tvalueNumber(Instruction instr) {
295294
result = nonUniqueValueNumber(instr)
296295
or
297-
exists(IRFunction irFunc |
298-
uniqueValueNumber(instr, irFunc) and
299-
result = TUniqueValueNumber(irFunc, instr)
300-
)
296+
uniqueValueNumber(instr) and
297+
result = TUniqueValueNumber(instr)
301298
}
302299

303300
/**

0 commit comments

Comments
 (0)