Skip to content

Commit 37b99df

Browse files
committed
C++: Remove VariableGroup
It's empty in the unaliased SSA, and the aliased SSA has been removed.
1 parent a83d733 commit 37b99df

File tree

8 files changed

+10
-401
lines changed

8 files changed

+10
-401
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaImplCommon.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ predicate ignoreInstruction(Instruction instr) {
4040
instr instanceof AliasedDefinitionInstruction or
4141
instr instanceof AliasedUseInstruction or
4242
instr instanceof InitializeNonLocalInstruction or
43-
instr instanceof ReturnIndirectionInstruction or
44-
instr instanceof UninitializedGroupInstruction
43+
instr instanceof ReturnIndirectionInstruction
4544
)
4645
}
4746

cpp/ql/lib/semmle/code/cpp/ir/implementation/Opcode.qll

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,17 +1250,6 @@ module Opcode {
12501250
}
12511251
}
12521252

1253-
/**
1254-
* The `Opcode` for a `UninitializedGroup`.
1255-
*
1256-
* See the `UninitializedGroupInstruction` documentation for more details.
1257-
*/
1258-
class UninitializedGroup extends Opcode, TUninitializedGroup {
1259-
final override string toString() { result = "UninitializedGroup" }
1260-
1261-
override GroupedMemoryAccess getWriteMemoryAccess() { any() }
1262-
}
1263-
12641253
/**
12651254
* The `Opcode` for an `InlineAsmInstruction`.
12661255
*

cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/TInstruction.qll

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ newtype TInstruction =
3030
TUnaliasedSsaChiInstruction(TRawInstruction primaryInstruction) { none() } or
3131
TUnaliasedSsaUnreachedInstruction(IRFunctionBase irFunc) {
3232
UnaliasedSsa::Ssa::hasUnreachedInstruction(irFunc)
33-
} or
34-
TUnaliasedSsaUninitializedGroupInstruction(UnaliasedSsa::Ssa::VariableGroup vg)
33+
}
3534

3635
/**
3736
* Provides wrappers for the constructors of each branch of `TInstruction` that is used by the
@@ -52,11 +51,7 @@ module UnaliasedSsaInstructions {
5251

5352
class TChiInstruction = TUnaliasedSsaChiInstruction;
5453

55-
class TUninitializedGroupInstruction = TUnaliasedSsaUninitializedGroupInstruction;
56-
57-
class TRawOrUninitializedGroupInstruction = TRawInstruction or TUninitializedGroupInstruction;
58-
59-
TChiInstruction chiInstruction(TRawOrUninitializedGroupInstruction primaryInstruction) {
54+
TChiInstruction chiInstruction(TRawInstruction primaryInstruction) {
6055
result = TUnaliasedSsaChiInstruction(primaryInstruction)
6156
}
6257

@@ -65,10 +60,4 @@ module UnaliasedSsaInstructions {
6560
TUnreachedInstruction unreachedInstruction(IRFunctionBase irFunc) {
6661
result = TUnaliasedSsaUnreachedInstruction(irFunc)
6762
}
68-
69-
class VariableGroup = UnaliasedSsa::Ssa::VariableGroup;
70-
71-
// This really should just be `TUnaliasedSsaUninitializedGroupInstruction`, but that makes the
72-
// compiler realize that certain expressions in `SSAConstruction` are unsatisfiable.
73-
TRawOrUninitializedGroupInstruction uninitializedGroup(VariableGroup vg) { none() }
7463
}

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

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,47 +2169,6 @@ class ChiInstruction extends Instruction {
21692169
final predicate isPartialUpdate() { Construction::chiOnlyPartiallyUpdatesLocation(this) }
21702170
}
21712171

2172-
/**
2173-
* An instruction that initializes a set of allocations that are each assigned
2174-
* the same "virtual variable".
2175-
*
2176-
* As an example, consider the following snippet:
2177-
* ```
2178-
* int a;
2179-
* int b;
2180-
* int* p;
2181-
* if(b) {
2182-
* p = &a;
2183-
* } else {
2184-
* p = &b;
2185-
* }
2186-
* *p = 5;
2187-
* int x = a;
2188-
* ```
2189-
*
2190-
* Since both the address of `a` and `b` reach `p` at `*p = 5` the IR alias
2191-
* analysis will create a region that contains both `a` and `b`. The region
2192-
* containing both `a` and `b` are initialized by an `UninitializedGroup`
2193-
* instruction in the entry block of the enclosing function.
2194-
*/
2195-
class UninitializedGroupInstruction extends Instruction {
2196-
UninitializedGroupInstruction() { this.getOpcode() instanceof Opcode::UninitializedGroup }
2197-
2198-
/**
2199-
* Gets an `IRVariable` whose memory is initialized by this instruction, if any.
2200-
* Note: Allocations that are not represented as `IRVariable`s (such as
2201-
* dynamic allocations) are not returned by this predicate even if this
2202-
* instruction initializes such memory.
2203-
*/
2204-
final IRVariable getAnIRVariable() {
2205-
result = Construction::getAnUninitializedGroupVariable(this)
2206-
}
2207-
2208-
final override string getImmediateString() {
2209-
result = strictconcat(this.getAnIRVariable().toString(), ",")
2210-
}
2211-
}
2212-
22132172
/**
22142173
* An instruction representing unreachable code.
22152174
*

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,6 @@ predicate hasUnreachedInstruction(IRFunction func) {
426426
)
427427
}
428428

429-
IRVariable getAnUninitializedGroupVariable(UninitializedGroupInstruction instr) { none() }
430-
431429
import CachedForDebugging
432430

433431
cached

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

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,47 +2169,6 @@ class ChiInstruction extends Instruction {
21692169
final predicate isPartialUpdate() { Construction::chiOnlyPartiallyUpdatesLocation(this) }
21702170
}
21712171

2172-
/**
2173-
* An instruction that initializes a set of allocations that are each assigned
2174-
* the same "virtual variable".
2175-
*
2176-
* As an example, consider the following snippet:
2177-
* ```
2178-
* int a;
2179-
* int b;
2180-
* int* p;
2181-
* if(b) {
2182-
* p = &a;
2183-
* } else {
2184-
* p = &b;
2185-
* }
2186-
* *p = 5;
2187-
* int x = a;
2188-
* ```
2189-
*
2190-
* Since both the address of `a` and `b` reach `p` at `*p = 5` the IR alias
2191-
* analysis will create a region that contains both `a` and `b`. The region
2192-
* containing both `a` and `b` are initialized by an `UninitializedGroup`
2193-
* instruction in the entry block of the enclosing function.
2194-
*/
2195-
class UninitializedGroupInstruction extends Instruction {
2196-
UninitializedGroupInstruction() { this.getOpcode() instanceof Opcode::UninitializedGroup }
2197-
2198-
/**
2199-
* Gets an `IRVariable` whose memory is initialized by this instruction, if any.
2200-
* Note: Allocations that are not represented as `IRVariable`s (such as
2201-
* dynamic allocations) are not returned by this predicate even if this
2202-
* instruction initializes such memory.
2203-
*/
2204-
final IRVariable getAnIRVariable() {
2205-
result = Construction::getAnUninitializedGroupVariable(this)
2206-
}
2207-
2208-
final override string getImmediateString() {
2209-
result = strictconcat(this.getAnIRVariable().toString(), ",")
2210-
}
2211-
}
2212-
22132172
/**
22142173
* An instruction representing unreachable code.
22152174
*

0 commit comments

Comments
 (0)