Skip to content

Commit 57917be

Browse files
authored
Merge pull request #2480 from hvitved/dataflow/performance-tweaks
Data flow: Various performance tweaks
2 parents 37e9ff1 + b3990c5 commit 57917be

File tree

19 files changed

+190
-57
lines changed

19 files changed

+190
-57
lines changed

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}

csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}

0 commit comments

Comments
 (0)