@@ -725,6 +725,26 @@ private predicate boundedPhiCandValidForEdge(
725725 )
726726}
727727
728+ /**
729+ * Holds if `b + delta` is a valid bound for `phi`'s `rix`th input edge.
730+ * - `upper = true` : `phi <= b + delta`
731+ * - `upper = false` : `phi >= b + delta`
732+ */
733+ private predicate boundedPhiStep (
734+ SsaPhiNode phi , Bound b , int delta , boolean upper , boolean fromBackEdge , int origdelta ,
735+ Reason reason , int rix
736+ ) {
737+ exists ( SsaVariable inp , SsaReadPositionPhiInputEdge edge |
738+ rankedPhiInput ( phi , inp , edge , rix ) and
739+ boundedPhiCandValidForEdge ( phi , b , delta , upper , fromBackEdge , origdelta , reason , inp , edge ) and
740+ (
741+ rix = 1
742+ or
743+ boundedPhiStep ( phi , b , delta , upper , fromBackEdge , origdelta , reason , rix - 1 )
744+ )
745+ )
746+ }
747+
728748/**
729749 * Holds if `b + delta` is a valid bound for `phi`.
730750 * - `upper = true` : `phi <= b + delta`
@@ -734,8 +754,9 @@ private predicate boundedPhi(
734754 SsaPhiNode phi , Bound b , int delta , boolean upper , boolean fromBackEdge , int origdelta ,
735755 Reason reason
736756) {
737- forex ( SsaVariable inp , SsaReadPositionPhiInputEdge edge | edge .phiInput ( phi , inp ) |
738- boundedPhiCandValidForEdge ( phi , b , delta , upper , fromBackEdge , origdelta , reason , inp , edge )
757+ exists ( int r |
758+ boundedPhiStep ( phi , b , delta , upper , fromBackEdge , origdelta , reason , r ) and
759+ maxPhiInputRank ( phi , r )
739760 )
740761}
741762
0 commit comments