C++: Fix SSA for array writes.

This commit is contained in:
Mathias Vorreiter Pedersen
2022-11-16 13:48:02 +00:00
parent 3e5c66e932
commit 3b1b8cc720

View File

@@ -157,11 +157,11 @@ private module Cached {
predicate isUse(boolean certain, Operand op, Instruction base, int ind, int indirectionIndex) {
not ignoreOperand(op) and
certain = true and
exists(LanguageType type, int m, int ind0 |
exists(LanguageType type, int upper, int ind0 |
type = getLanguageType(op) and
m = countIndirectionsForCppType(type) and
upper = countIndirectionsForCppType(type) and
isUseImpl(op, base, ind0) and
ind = ind0 + [0 .. m] and
ind = ind0 + [0 .. upper] and
indirectionIndex = ind - ind0
)
}
@@ -205,7 +205,7 @@ private module Cached {
int indirectionIndex
) {
certain = true and
exists(int ind0, CppType type, int m |
exists(int ind0, CppType type, int lower, int upper |
address =
[
instr.(StoreInstruction).getDestinationAddressOperand(),
@@ -216,9 +216,10 @@ private module Cached {
|
isDefImpl(address, base, ind0) and
type = getLanguageType(address) and
m = countIndirectionsForCppType(type) and
ind = ind0 + [1 .. m] and
indirectionIndex = ind - (ind0 + 1)
upper = countIndirectionsForCppType(type) and
ind = ind0 + [lower .. upper] and
indirectionIndex = ind - (ind0 + lower) and
if type.hasType(any(Cpp::ArrayType arrayType), true) then lower = 0 else lower = 1
)
}