@@ -160,6 +160,24 @@ class Node extends TIRDataFlowNode {
160
160
/** Gets the operands corresponding to this node, if any. */
161
161
Operand asOperand ( ) { result = this .( OperandNode ) .getOperand ( ) }
162
162
163
+ /** Holds if this node is at index `i` in basic block `block`. */
164
+ final predicate hasIndexInBlock ( IRBlock block , int i ) {
165
+ this .asInstruction ( ) = block .getInstruction ( i )
166
+ or
167
+ this .asOperand ( ) .getUse ( ) = block .getInstruction ( i )
168
+ or
169
+ this .( SsaPhiNode ) .getPhiNode ( ) .getBasicBlock ( ) = block and i = - 1
170
+ or
171
+ this .( RawIndirectOperand ) .getOperand ( ) .getUse ( ) = block .getInstruction ( i )
172
+ or
173
+ this .( RawIndirectInstruction ) .getInstruction ( ) = block .getInstruction ( i )
174
+ or
175
+ this .( PostUpdateNode ) .getPreUpdateNode ( ) .hasIndexInBlock ( block , i )
176
+ }
177
+
178
+ /** Gets the basic block of this node, if any. */
179
+ final IRBlock getBasicBlock ( ) { this .hasIndexInBlock ( result , _) }
180
+
163
181
/**
164
182
* Gets the non-conversion expression corresponding to this node, if any.
165
183
* This predicate only has a result on nodes that represent the value of
@@ -530,7 +548,7 @@ class SsaPhiNode extends Node, TSsaPhiNode {
530
548
*/
531
549
final Node getAnInput ( boolean fromBackEdge ) {
532
550
localFlowStep ( result , this ) and
533
- if phi .getBasicBlock ( ) .dominates ( getBasicBlock ( result ) )
551
+ if phi .getBasicBlock ( ) .dominates ( result . getBasicBlock ( ) )
534
552
then fromBackEdge = true
535
553
else fromBackEdge = false
536
554
}
@@ -1887,7 +1905,7 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
1887
1905
e = value .getAnInstruction ( ) .getConvertedResultExpression ( ) and
1888
1906
result .getConvertedExpr ( ) = e and
1889
1907
guardChecks ( g , value .getAnInstruction ( ) .getConvertedResultExpression ( ) , edge ) and
1890
- g .controls ( getBasicBlock ( result ) , edge )
1908
+ g .controls ( result . getBasicBlock ( ) , edge )
1891
1909
)
1892
1910
}
1893
1911
}
0 commit comments