8000 C++: Cache and fix join order in 'hasIncompleteSsa'. · github/codeql@0836f0b · GitHub
[go: up one dir, main page]

Skip to content

Commit 0836f0b

Browse files
committed
C++: Cache and fix join order in 'hasIncompleteSsa'.
1 parent c3c18bd commit 0836f0b

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,20 @@ private module Cached {
731731
or
732732
instruction = getChi(result.(UninitializedGroupInstruction))
733733
}
734+
735+
/**
736+
* Holds if the def-use information for `f` may have been omitted because it
737+
* was too expensive to compute. This happens if one of the memory allocations
738+
* in `f` is a busy definition (i.e., it has many different overlapping uses).
739+
*/
740+
pragma[nomagic]
741+
cached
742+
predicate hasIncompleteSsa(IRFunction f) {
743+
exists(Alias::MemoryLocation0 defLocation |
744+
Alias::isBusyDef(pragma[only_bind_into](defLocation)) and
745+
defLocation.getIRFunction() = f
746+
)
747+
}
734748
}
735749

736750
private Instruction getNewInstruction(OldInstruction instr) { getOldInstruction(result) = instr }
@@ -1319,18 +1333,6 @@ predicate canReuseSsaForMemoryResult(Instruction instruction) {
13191333
// We don't support reusing SSA for any location that could create a `Chi` instruction.
13201334
}
13211335

1322-
/**
1323-
* Holds if the def-use information for `f` may have been omitted because it
1324-
* was too expensive to compute. This happens if one of the memory allocations
1325-
* in `f` is a busy definition (i.e., it has many different overlapping uses).
1326-
*/
1327-
predicate hasIncompleteSsa(IRFunction f) {
1328-
exists(Alias::MemoryLocation0 defLocation |
1329-
Alias::isBusyDef(defLocation) and
1330-
defLocation.getIRFunction() = f
1331-
)
1332-
}
1333-
13341336
/**
13351337
* Expose some of the internal predicates to PrintSSA.qll. We do this by publicly importing those modules in the
13361338
* `DebugSsa` module, which is then imported by PrintSSA.

cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,20 @@ private module Cached {
731731
or
732732
instruction = getChi(result.(UninitializedGroupInstruction))
733733
}
734+
735+
/**
736+
* Holds if the def-use information for `f` may have been omitted because it
737+
* was too expensive to compute. This happens if one of the memory allocations
738+
* in `f` is a busy definition (i.e., it has many different overlapping uses).
739+
*/
740+
pragma[nomagic]
741+
cached
742+
predicate hasIncompleteSsa(IRFunction f) {
743+
exists(Alias::MemoryLocation0 defLocation |
744+
Alias::isBusyDef(pragma[only_bind_into](defLocation)) and
745+
defLocation.getIRFunction() = f
746+
)
747+
}
734748
}
735749

736750
private Instruction getNewInstruction(OldInstruction instr) { getOldInstruction(result) = instr }
@@ -1319,18 +1333,6 @@ predicate canReuseSsaForMemoryResult(Instruction instruction) {
13191333
// We don't support reusing SSA for any location that could create a `Chi` instruction.
13201334
}
13211335

1322-
/**
1323-
* Holds if the def-use information for `f` may have been omitted because it
1324-
* was too expensive to compute. This happens if one of the memory allocations
1325-
* in `f` is a busy definition (i.e., it has many different overlapping uses).
1326-
*/
1327-
predicate hasIncompleteSsa(IRFunction f) {
1328-
exists(Alias::MemoryLocation0 defLocation |
1329-
Alias::isBusyDef(defLocation) and
1330-
defLocation.getIRFunction() = f
1331-
)
1332-
}
1333-
13341336
/**
13351337
* Expose some of the internal predicates to PrintSSA.qll. We do this by publicly importing those modules in the
13361338
* `DebugSsa` module, which is then imported by PrintSSA.

0 commit comments

Comments
 (0)
0