@@ -160,6 +160,24 @@ class Node extends TIRDataFlowNode {
160160 /** Gets the operands corresponding to this node, if any. */
161161 Operand asOperand ( ) { result = this .( OperandNode ) .getOperand ( ) }
162162
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+
163181 /**
164182 * Gets the non-conversion expression corresponding to this node, if any.
165183 * This predicate only has a result on nodes that represent the value of
@@ -530,7 +548,7 @@ class SsaPhiNode extends Node, TSsaPhiNode {
530548 */
531549 final Node getAnInput ( boolean fromBackEdge ) {
532550 localFlowStep ( result , this ) and
533- if phi .getBasicBlock ( ) .dominates ( getBasicBlock ( result ) )
551+ if phi .getBasicBlock ( ) .dominates ( result . getBasicBlock ( ) )
534552 then fromBackEdge = true
535553 else fromBackEdge = false
536554 }
@@ -1887,7 +1905,7 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
18871905 e = value .getAnInstruction ( ) .getConvertedResultExpression ( ) and
18881906 result .getConvertedExpr ( ) = e and
18891907 guardChecks ( g , value .getAnInstruction ( ) .getConvertedResultExpression ( ) , edge ) and
1890- g .controls ( getBasicBlock ( result ) , edge )
1908+ g .controls ( result . getBasicBlock ( ) , edge )
18911909 )
18921910 }
18931911}
0 commit comments