Skip to content

Commit 2783214

Browse files
committed
C++: Phi-node conflation is not about vvars
1 parent 95a8dcb commit 2783214

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,18 @@ private module Cached {
7373
or
7474
instruction.getOpcode() instanceof Opcode::InitializeNonLocal
7575
or
76+
// Chi instructions track virtual variables, and therefore a chi instruction is
77+
// conflated if it's associated with the aliased virtual variable.
7678
exists(OldInstruction oldInstruction | instruction = Chi(oldInstruction) |
7779
Alias::getResultMemoryLocation(oldInstruction).getVirtualVariable() instanceof
7880
Alias::AliasedVirtualVariable
7981
)
8082
or
83+
// Phi instructions track locations, and therefore a phi instruction is
84+
// conflated if it's associated with a conflated location.
8185
exists(Alias::MemoryLocation location |
8286
instruction = Phi(_, location) and
83-
location.getVirtualVariable() instanceof Alias::AliasedVirtualVariable
87+
not exists(location.getAllocation())
8488
)
8589
}
8690

cpp/ql/test/library-tests/ir/ssa/aliased_ssa_sanity.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ useNotDominatedByDefinition
1818
switchInstructionWithoutDefaultEdge
1919
notMarkedAsConflated
2020
wronglyMarkedAsConflated
21-
| ssa.cpp:281:7:281:7 | Phi: definition of x |
2221
missingCanonicalLanguageType
2322
multipleCanonicalLanguageTypes
2423
missingIRType

0 commit comments

Comments
 (0)