Skip to content

Commit 6c20585

Browse files
hvitvedmichaelnebel
authored andcommitted
C#: Eliminate bad magic optimization
``` [2022-01-14 08:57:14] (253s) Tuple counts for Stmt::getAChild#bbf/3@8dfbc66f after 1m53s: 4922010396 ~5% {3} r1 = JOIN ControlFlowElement::ControlFlowElement::getEnclosingCallable_dispred#ff_10#join_rhs WITH ControlFlowElement::ControlFlowElement::getEnclosingCallable_dispred#ff_10#join_rhs ON FIRST 1 OUTPUT Lhs.1 'cfe', Rhs.1 'cfe', Lhs.0 'c' 1597068 ~2% {3} r2 = JOIN r1 WITH Element::Element::getAChild_dispred#ff ON FIRST 2 OUTPUT Lhs.0 'cfe', Lhs.2 'c', Lhs.1 'result' return r2 ```
1 parent 411d2b2 commit 6c20585

File tree

1 file changed

+3
-7
lines changed
  • csharp/ql/lib/semmle/code/csharp

1 file changed

+3
-7
lines changed

csharp/ql/lib/semmle/code/csharp/Stmt.qll

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -946,17 +946,13 @@ class TryStmt extends Stmt, @try_stmt {
946946
exists(ControlFlowElement mid |
947947
mid = this.getATriedElement() and
948948
not mid instanceof TryStmt and
949-
result = getAChild(mid, mid.getEnclosingCallable())
949+
result = mid.getAChild() and
950+
pragma[only_bind_into](mid.getEnclosingCallable()) =
951+
pragma[only_bind_into](result.getEnclosingCallable())
950952
)
951953
}
952954
}
953955

954-
pragma[noinline]
955-
private ControlFlowElement getAChild(ControlFlowElement cfe, Callable c) {
956-
result = cfe.getAChild() and
957-
c = result.getEnclosingCallable()
958-
}
959-
960956
/**
961957
* A `catch` clause within a `try` statement.
962958
*

0 commit comments

Comments
 (0)