File tree Expand file tree Collapse file tree 4 files changed +64
-72
lines changed
csharp/ql/lib/semmle/code
controlflow/internal/pressa
dataflow/internal/basessa
ruby/ql/lib/codeql/ruby/dataflow/internal Expand file tree Collapse file tree 4 files changed +64
-72
lines changed Original file line number Diff line number Diff line change @@ -141,25 +141,23 @@ private module Liveness {
141
141
142
142
private import Liveness
143
143
144
- /** Holds if `bb1` strictly dominates `bb2`. */
145
- private predicate strictlyDominates ( BasicBlock bb1 , BasicBlock bb2 ) {
146
- bb1 = getImmediateBasicBlockDominator + ( bb2 )
147
- }
148
-
149
- /** Holds if `bb1` dominates a predecessor of `bb2`. */
150
- private predicate dominatesPredecessor ( BasicBlock bb1 , BasicBlock bb2 ) {
151
- exists ( BasicBlock pred | pred = getABasicBlockPredecessor ( bb2 ) |
152
- bb1 = pred
153
- or
154
- strictlyDominates ( bb1 , pred )
155
- )
156
- }
157
-
158
- /** Holds if `df` is in the dominance frontier of `bb`. */
159
- pragma [ noinline]
144
+ /**
145
+ * Holds if `df` is in the dominance frontier of `bb`.
146
+ *
147
+ * This is equivalent to:
148
+ *
149
+ * ```ql
150
+ * bb = getImmediateBasicBlockDominator*(getABasicBlockPredecessor(df)) and
151
+ * not bb = getImmediateBasicBlockDominator+(df)
152
+ * ```
153
+ */
160
154
private predicate inDominanceFrontier ( BasicBlock bb , BasicBlock df ) {
161
- dominatesPredecessor ( bb , df ) and
162
- not strictlyDominates ( bb , df )
155
+ bb = getABasicBlockPredecessor ( df ) and not bb = getImmediateBasicBlockDominator ( df )
156
+ or
157
+ exists ( BasicBlock prev | inDominanceFrontier ( prev , df ) |
158
+ bb = getImmediateBasicBlockDominator ( prev ) and
159
+ not bb = getImmediateBasicBlockDominator ( df )
160
+ )
163
161
}
164
162
165
163
/**
Original file line number Diff line number Diff line change @@ -141,25 +141,23 @@ private module Liveness {
141
141
142
142
private import Liveness
143
143
144
- /** Holds if `bb1` strictly dominates `bb2`. */
145
- private predicate strictlyDominates ( BasicBlock bb1 , BasicBlock bb2 ) {
146
- bb1 = getImmediateBasicBlockDominator + ( bb2 )
147
- }
148
-
149
- /** Holds if `bb1` dominates a predecessor of `bb2`. */
150
- private predicate dominatesPredecessor ( BasicBlock bb1 , BasicBlock bb2 ) {
151
- exists ( BasicBlock pred | pred = getABasicBlockPredecessor ( bb2 ) |
152
- bb1 = pred
153
- or
154
- strictlyDominates ( bb1 , pred )
155
- )
156
- }
157
-
158
- /** Holds if `df` is in the dominance frontier of `bb`. */
159
- pragma [ noinline]
144
+ /**
145
+ * Holds if `df` is in the dominance frontier of `bb`.
146
+ *
147
+ * This is equivalent to:
148
+ *
149
+ * ```ql
150
+ * bb = getImmediateBasicBlockDominator*(getABasicBlockPredecessor(df)) and
151
+ * not bb = getImmediateBasicBlockDominator+(df)
152
+ * ```
153
+ */
160
154
private predicate inDominanceFrontier ( BasicBlock bb , BasicBlock df ) {
161
- dominatesPredecessor ( bb , df ) and
162
- not strictlyDominates ( bb , df )
155
+ bb = getABasicBlockPredecessor ( df ) and not bb = getImmediateBasicBlockDominator ( df )
156
+ or
157
+ exists ( BasicBlock prev | inDominanceFrontier ( prev , df ) |
158
+ bb = getImmediateBasicBlockDominator ( prev ) and
159
+ not bb = getImmediateBasicBlockDominator ( df )
160
+ )
163
161
}
164
162
165
163
/**
Original file line number Diff line number Diff line change @@ -141,25 +141,23 @@ private module Liveness {
141
141
142
142
private import Liveness
143
143
144
- /** Holds if `bb1` strictly dominates `bb2`. */
145
- private predicate strictlyDominates ( BasicBlock bb1 , BasicBlock bb2 ) {
146
- bb1 = getImmediateBasicBlockDominator + ( bb2 )
147
- }
148
-
149
- /** Holds if `bb1` dominates a predecessor of `bb2`. */
150
- private predicate dominatesPredecessor ( BasicBlock bb1 , BasicBlock bb2 ) {
151
- exists ( BasicBlock pred | pred = getABasicBlockPredecessor ( bb2 ) |
152
- bb1 = pred
153
- or
154
- strictlyDominates ( bb1 , pred )
155
- )
156
- }
157
-
158
- /** Holds if `df` is in the dominance frontier of `bb`. */
159
- pragma [ noinline]
144
+ /**
145
+ * Holds if `df` is in the dominance frontier of `bb`.
146
+ *
147
+ * This is equivalent to:
148
+ *
149
+ * ```ql
150
+ * bb = getImmediateBasicBlockDominator*(getABasicBlockPredecessor(df)) and
151
+ * not bb = getImmediateBasicBlockDominator+(df)
152
+ * ```
153
+ */
160
154
private predicate inDominanceFrontier ( BasicBlock bb , BasicBlock df ) {
161
- dominatesPredecessor ( bb , df ) and
162
- not strictlyDominates ( bb , df )
155
+ bb = getABasicBlockPredecessor ( df ) and not bb = getImmediateBasicBlockDominator ( df )
156
+ or
157
+ exists ( BasicBlock prev | inDominanceFrontier ( prev , df ) |
158
+ bb = getImmediateBasicBlockDominator ( prev ) and
159
+ not bb = getImmediateBasicBlockDominator ( df )
160
+ )
163
161
}
164
162
165
163
/**
Original file line number Diff line number Diff line change @@ -141,25 +141,23 @@ private module Liveness {
141
141
142
142
private import Liveness
143
143
144
- /** Holds if `bb1` strictly dominates `bb2`. */
145
- private predicate strictlyDominates ( BasicBlock bb1 , BasicBlock bb2 ) {
146
- bb1 = getImmediateBasicBlockDominator + ( bb2 )
147
- }
148
-
149
- /** Holds if `bb1` dominates a predecessor of `bb2`. */
150
- private predicate dominatesPredecessor ( BasicBlock bb1 , BasicBlock bb2 ) {
151
- exists ( BasicBlock pred | pred = getABasicBlockPredecessor ( bb2 ) |
152
- bb1 = pred
153
- or
154
- strictlyDominates ( bb1 , pred )
155
- )
156
- }
157
-
158
- /** Holds if `df` is in the dominance frontier of `bb`. */
159
- pragma [ noinline]
144
+ /**
145
+ * Holds if `df` is in the dominance frontier of `bb`.
146
+ *
147
+ * This is equivalent to:
148
+ *
149
+ * ```ql
150
+ * bb = getImmediateBasicBlockDominator*(getABasicBlockPredecessor(df)) and
151
+ * not bb = getImmediateBasicBlockDominator+(df)
152
+ * ```
153
+ */
160
154
private predicate inDominanceFrontier ( BasicBlock bb , BasicBlock df ) {
161
- dominatesPredecessor ( bb , df ) and
162
- not strictlyDominates ( bb , df )
155
+ bb = getABasicBlockPredecessor ( df ) and not bb = getImmediateBasicBlockDominator ( df )
156
+ or
157
+ exists ( BasicBlock prev | inDominanceFrontier ( prev , df ) |
158
+ bb = getImmediateBasicBlockDominator ( prev ) and
159
+ not bb = getImmediateBasicBlockDominator ( df )
160
+ )
163
161
}
164
162
165
163
/**
You can’t perform that action at this time.
0 commit comments