File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
cpp/ql/src/semmle/code/cpp Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,6 @@ class SubBasicBlock extends ControlFlowNodeBase {
101101 * start from 0, and the node at index 0 always exists and compares equal
102102 * to `this`.
103103 */
104- pragma [ nomagic]
105104 ControlFlowNode getNode ( int index ) {
106105 exists ( BasicBlock bb |
107106 exists ( int outerIndex |
@@ -115,6 +114,10 @@ class SubBasicBlock extends ControlFlowNodeBase {
115114 * Gets the index of the node in this `SubBasicBlock` that has `indexInBB` in
116115 * `bb`, where `bb` is equal to `getBasicBlock()`.
117116 */
117+ // This predicate is factored out of `getNode` to ensure a good join order.
118+ // It's sensitive to bad magic, so it has `pragma[nomagic]` on it. For
119+ // example, it can get very slow if `getNode` is pragma[nomagic], which could
120+ // mean it might get very slow if `getNode` is used in the wrong context.
118121 pragma [ nomagic]
119122 private int outerToInnerIndex ( BasicBlock bb , int indexInBB ) {
120123 indexInBB = result + this .getIndexInBasicBlock ( bb ) and
Original file line number Diff line number Diff line change @@ -101,7 +101,6 @@ class SubBasicBlock extends ControlFlowNodeBase {
101101 * start from 0, and the node at index 0 always exists and compares equal
102102 * to `this`.
103103 */
104- pragma [ nomagic]
105104 ControlFlowNode getNode ( int index ) {
106105 exists ( BasicBlock bb |
107106 exists ( int outerIndex |
@@ -115,6 +114,10 @@ class SubBasicBlock extends ControlFlowNodeBase {
115114 * Gets the index of the node in this `SubBasicBlock` that has `indexInBB` in
116115 * `bb`, where `bb` is equal to `getBasicBlock()`.
117116 */
117+ // This predicate is factored out of `getNode` to ensure a good join order.
118+ // It's sensitive to bad magic, so it has `pragma[nomagic]` on it. For
119+ // example, it can get very slow if `getNode` is pragma[nomagic], which could
120+ // mean it might get very slow if `getNode` is used in the wrong context.
118121 pragma [ nomagic]
119122 private int outerToInnerIndex ( BasicBlock bb , int indexInBB ) {
120123 indexInBB = result + this .getIndexInBasicBlock ( bb ) and
You can’t perform that action at this time.
0 commit comments