Skip to content

Commit af4a6e4

Browse files
authored
Merge pull request #2806 from jbj/coversEntireVariable-join
C++: Fix coversEntireVariable perf in AliasedSSA
2 parents 09960e0 + cf1bc69 commit af4a6e4

File tree

1 file changed

+6
-3
lines changed
  • cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,12 @@ class VariableMemoryLocation extends TVariableMemoryLocation, AllocationMemoryLo
220220
/**
221221
* Holds if this memory location covers the entire variable.
222222
*/
223-
final predicate coversEntireVariable() {
224-
startBitOffset = 0 and
225-
endBitOffset = var.getIRType().getByteSize() * 8
223+
final predicate coversEntireVariable() { varIRTypeHasBitRange(startBitOffset, endBitOffset) }
224+
225+
pragma[noinline]
226+
private predicate varIRTypeHasBitRange(int start, int end) {
227+
start = 0 and
228+
end = var.getIRType().getByteSize() * 8
226229
}
227230
}
228231

0 commit comments

Comments
 (0)