mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
C++: Exclude BlockVar computation for "large" vars
This commit is contained in:
@@ -490,7 +490,8 @@ module FlowVar_internal {
|
||||
private SubBasicBlock getAReachedBlockVarSBB(TBlockVar start) {
|
||||
exists(Variable v |
|
||||
start = TBlockVar(result, v) and
|
||||
variableLiveInSBB(result, v)
|
||||
variableLiveInSBB(result, v) and
|
||||
not largeVariable(v, _, _)
|
||||
)
|
||||
or
|
||||
exists(SubBasicBlock mid, SubBasicBlock sbbDef, Variable v |
|
||||
@@ -503,6 +504,16 @@ module FlowVar_internal {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `v` may have too many combinations of definitions and reached
|
||||
* blocks for us the feasibly compute its def-use relation.
|
||||
*/
|
||||
private predicate largeVariable(Variable v, int liveBlocks, int defs) {
|
||||
liveBlocks = strictcount(SubBasicBlock sbb | variableLiveInSBB(sbb, v)) and
|
||||
defs = strictcount(SubBasicBlock sbb | exists(TBlockVar(sbb, v))) and
|
||||
liveBlocks * defs > 1000000
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if a value held in `v` at the start of `sbb` (or after the first
|
||||
* assignment, if that assignment is to `v`) might later be read.
|
||||
|
||||
Reference in New Issue
Block a user