@@ -371,17 +371,29 @@ predicate ssaFlow(Node nodeFrom, Node nodeTo) {
371371 )
372372}
373373
374+ /**
375+ * Holds if `use` is a use of `sv` and is a next adjacent use of `phi` in
376+ * index `i1` in basic block `bb1`.
377+ *
378+ * This predicate exists to prevent an early join of `adjacentDefRead` with `definesAt`.
379+ */
380+ pragma [ nomagic]
381+ private predicate fromPhiNodeToUse ( PhiNode phi , SourceVariable sv , IRBlock bb1 , int i1 , UseOrPhi use ) {
382+ exists ( IRBlock bb2 , int i2 |
383+ use .asDefOrUse ( ) .hasIndexInBlock ( bb2 , i2 , sv ) and
384+ adjacentDefRead ( pragma [ only_bind_into ] ( phi ) , pragma [ only_bind_into ] ( bb1 ) ,
385+ pragma [ only_bind_into ] ( i1 ) , pragma [ only_bind_into ] ( bb2 ) , pragma [ only_bind_into ] ( i2 ) )
386+ )
387+ }
388+
374389/** Holds if `nodeTo` receives flow from the phi node `nodeFrom`. */
375390predicate fromPhiNode ( SsaPhiNode nodeFrom , Node nodeTo ) {
376391 exists ( PhiNode phi , SourceVariable sv , IRBlock bb1 , int i1 , UseOrPhi use |
377392 phi = nodeFrom .getPhiNode ( ) and
378393 phi .definesAt ( sv , bb1 , i1 ) and
379394 useToNode ( use , nodeTo )
380395 |
381- exists ( IRBlock bb2 , int i2 |
382- use .asDefOrUse ( ) .hasIndexInBlock ( bb2 , i2 , sv ) and
383- adjacentDefRead ( phi , bb1 , i1 , bb2 , i2 )
384- )
396+ fromPhiNodeToUse ( phi , sv , bb1 , i1 , use )
385397 or
386398 exists ( PhiNode phiTo |
387399 lastRefRedef ( phi , _, _, phiTo ) and
0 commit comments