зеркало из https://github.com/github/codeql.git
C++: Replace FastTC with iteration in ignoreExpr
Before, `ignoreExprAndDescendants` and its related predicates had this timing on Wireshark. #TranslatedElement::getRealParent#ffPlus#swapped ......... 25.7s TranslatedElement::ignoreExprAndDescendants#f ............ 16.9s TranslatedElement::getRealParent#ff ...................... 7.2s TranslatedElement::ignoreExpr#f .......................... 4.8s TranslatedElement::ignoreExpr#f#antijoin_rhs ............. 3.2s TranslatedElement::getRealParent#ff_10#higher_order_body . 2.2s After, it looks like this TranslatedElement::ignoreExprAndDescendants#f ............ 23.4s (executed 9 times) TranslatedElement::getRealParent#ff ...................... 6.3s TranslatedElement::ignoreExpr#f#antijoin_rhs ............. 4.8s TranslatedElement::ignoreExpr#f .......................... 3.7s TranslatedElement::getRealParent#ff_10#join_rhs .......... 2.5s project#TranslatedElement::getRealParent#ff .............. 1.3s
This commit is contained in:
Родитель
6243c722c6
Коммит
66e7c26d4e
|
@ -36,10 +36,8 @@ private Element getRealParent(Expr expr) {
|
|||
predicate isIRConstant(Expr expr) { exists(expr.getValue()) }
|
||||
|
||||
/**
|
||||
* Holds if `expr` and all of its descendants should be ignored for the purposes
|
||||
* of IR generation due to some property of `expr` itself. Unlike
|
||||
* `ignoreExpr()`, this predicate does not ignore an expression solely because
|
||||
* it is a descendant of an ignored element.
|
||||
* Holds if `expr` should be ignored for the purposes of IR generation due to
|
||||
* some property of `expr` or one of its ancestors.
|
||||
*/
|
||||
private predicate ignoreExprAndDescendants(Expr expr) {
|
||||
// Ignore parentless expressions
|
||||
|
@ -59,7 +57,8 @@ private predicate ignoreExprAndDescendants(Expr expr) {
|
|||
// REVIEW: Ignore initializers for `NewArrayExpr` until we determine how to
|
||||
// represent them.
|
||||
newExpr.getInitializer().getFullyConverted() = expr
|
||||
)
|
||||
) or
|
||||
ignoreExprAndDescendants(getRealParent(expr)) // recursive case
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,7 +79,7 @@ private predicate ignoreExprOnly(Expr expr) {
|
|||
*/
|
||||
private predicate ignoreExpr(Expr expr) {
|
||||
ignoreExprOnly(expr) or
|
||||
ignoreExprAndDescendants(getRealParent*(expr))
|
||||
ignoreExprAndDescendants(expr)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче