diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll index 82db3146630..bac7634cbd0 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll @@ -161,8 +161,13 @@ class IRBlock extends IRBlockBase { */ pragma[noinline] final IRBlock dominanceFrontier() { - this.dominates(result.getAPredecessor()) and - not this.strictlyDominates(result) + this.getASuccessor() = result and + not this.immediatelyDominates(result) + or + exists(IRBlock prev | result = prev.dominanceFrontier() | + this.immediatelyDominates(prev) and + not this.immediatelyDominates(result) + ) } /** @@ -201,8 +206,13 @@ class IRBlock extends IRBlockBase { */ pragma[noinline] final IRBlock postDominanceFrontier() { - this.postDominates(result.getASuccessor()) and - not this.strictlyPostDominates(result) + this.getAPredecessor() = result and + not this.immediatelyPostDominates(result) + or + exists(IRBlock prev | result = prev.postDominanceFrontier() | + this.immediatelyPostDominates(prev) and + not this.immediatelyPostDominates(result) + ) } /** diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRBlock.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRBlock.qll index 82db3146630..bac7634cbd0 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRBlock.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRBlock.qll @@ -161,8 +161,13 @@ class IRBlock extends IRBlockBase { */ pragma[noinline] final IRBlock dominanceFrontier() { - this.dominates(result.getAPredecessor()) and - not this.strictlyDominates(result) + this.getASuccessor() = result and + not this.immediatelyDominates(result) + or + exists(IRBlock prev | result = prev.dominanceFrontier() | + this.immediatelyDominates(prev) and + not this.immediatelyDominates(result) + ) } /** @@ -201,8 +206,13 @@ class IRBlock extends IRBlockBase { */ pragma[noinline] final IRBlock postDominanceFrontier() { - this.postDominates(result.getASuccessor()) and - not this.strictlyPostDominates(result) + this.getAPredecessor() = result and + not this.immediatelyPostDominates(result) + or + exists(IRBlock prev | result = prev.postDominanceFrontier() | + this.immediatelyPostDominates(prev) and + not this.immediatelyPostDominates(result) + ) } /** diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll index 82db3146630..bac7634cbd0 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll @@ -161,8 +161,13 @@ class IRBlock extends IRBlockBase { */ pragma[noinline] final IRBlock dominanceFrontier() { - this.dominates(result.getAPredecessor()) and - not this.strictlyDominates(result) + this.getASuccessor() = result and + not this.immediatelyDominates(result) + or + exists(IRBlock prev | result = prev.dominanceFrontier() | + this.immediatelyDominates(prev) and + not this.immediatelyDominates(result) + ) } /** @@ -201,8 +206,13 @@ class IRBlock extends IRBlockBase { */ pragma[noinline] final IRBlock postDominanceFrontier() { - this.postDominates(result.getASuccessor()) and - not this.strictlyPostDominates(result) + this.getAPredecessor() = result and + not this.immediatelyPostDominates(result) + or + exists(IRBlock prev | result = prev.postDominanceFrontier() | + this.immediatelyPostDominates(prev) and + not this.immediatelyPostDominates(result) + ) } /** diff --git a/csharp/ql/src/experimental/ir/implementation/raw/IRBlock.qll b/csharp/ql/src/experimental/ir/implementation/raw/IRBlock.qll index 82db3146630..bac7634cbd0 100644 --- a/csharp/ql/src/experimental/ir/implementation/raw/IRBlock.qll +++ b/csharp/ql/src/experimental/ir/implementation/raw/IRBlock.qll @@ -161,8 +161,13 @@ class IRBlock extends IRBlockBase { */ pragma[noinline] final IRBlock dominanceFrontier() { - this.dominates(result.getAPredecessor()) and - not this.strictlyDominates(result) + this.getASuccessor() = result and + not this.immediatelyDominates(result) + or + exists(IRBlock prev | result = prev.dominanceFrontier() | + this.immediatelyDominates(prev) and + not this.immediatelyDominates(result) + ) } /** @@ -201,8 +206,13 @@ class IRBlock extends IRBlockBase { */ pragma[noinline] final IRBlock postDominanceFrontier() { - this.postDominates(result.getASuccessor()) and - not this.strictlyPostDominates(result) + this.getAPredecessor() = result and + not this.immediatelyPostDominates(result) + or + exists(IRBlock prev | result = prev.postDominanceFrontier() | + this.immediatelyPostDominates(prev) and + not this.immediatelyPostDominates(result) + ) } /** diff --git a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/IRBlock.qll b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/IRBlock.qll index 82db3146630..bac7634cbd0 100644 --- a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/IRBlock.qll +++ b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/IRBlock.qll @@ -161,8 +161,13 @@ class IRBlock extends IRBlockBase { */ pragma[noinline] final IRBlock dominanceFrontier() { - this.dominates(result.getAPredecessor()) and - not this.strictlyDominates(result) + this.getASuccessor() = result and + not this.immediatelyDominates(result) + or + exists(IRBlock prev | result = prev.dominanceFrontier() | + this.immediatelyDominates(prev) and + not this.immediatelyDominates(result) + ) } /** @@ -201,8 +206,13 @@ class IRBlock extends IRBlockBase { */ pragma[noinline] final IRBlock postDominanceFrontier() { - this.postDominates(result.getASuccessor()) and - not this.strictlyPostDominates(result) + this.getAPredecessor() = result and + not this.immediatelyPostDominates(result) + or + exists(IRBlock prev | result = prev.postDominanceFrontier() | + this.immediatelyPostDominates(prev) and + not this.immediatelyPostDominates(result) + ) } /**