Skip to content

Commit d29d060

Browse files
authored
Merge pull request github#15401 from alexet/make-intended-join-order
CPP: Fix join ordering hints to make them do what they intend.
2 parents 77e724b + 891d398 commit d29d060

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,10 @@ class GlobalDefImpl extends DefOrUseImpl, TGlobalDefImpl {
609609
*/
610610
predicate adjacentDefRead(DefOrUse defOrUse1, UseOrPhi use) {
611611
exists(IRBlock bb1, int i1, SourceVariable v |
612-
defOrUse1.asDefOrUse().hasIndexInBlock(bb1, i1, v)
612+
defOrUse1
613+
.asDefOrUse()
614+
.hasIndexInBlock(pragma[only_bind_out](bb1), pragma[only_bind_out](i1),
615+
pragma[only_bind_out](v))
613616
|
614617
exists(IRBlock bb2, int i2, DefinitionExt def |
615618
adjacentDefReadExt(pragma[only_bind_into](def), pragma[only_bind_into](bb1),
@@ -631,7 +634,11 @@ predicate adjacentDefRead(DefOrUse defOrUse1, UseOrPhi use) {
631634
* flows to `useOrPhi`.
632635
*/
633636
private predicate globalDefToUse(GlobalDef globalDef, UseOrPhi useOrPhi) {
634-
exists(IRBlock bb1, int i1, SourceVariable v | globalDef.hasIndexInBlock(bb1, i1, v) |
637+
exists(IRBlock bb1, int i1, SourceVariable v |
638+
globalDef
639+
.hasIndexInBlock(pragma[only_bind_out](bb1), pragma[only_bind_out](i1),
640+
pragma[only_bind_out](v))
641+
|
635642
exists(IRBlock bb2, int i2 |
636643
adjacentDefReadExt(_, pragma[only_bind_into](bb1), pragma[only_bind_into](i1),
637644
pragma[only_bind_into](bb2), pragma[only_bind_into](i2)) and

0 commit comments

Comments
 (0)