@@ -1468,6 +1468,58 @@ module Make<LocationSig Location, InputSig<Location> Input> {
14681468 inputRefs = count ( BasicBlock bb , int i | AdjacentSsaRefs:: adjacentRefPhi ( bb , i , _, bbPhi , v ) ) and
14691469 inputRefs < 2
14701470 }
1471+
1472+ /**
1473+ * Gets counts of inconsistencies of each type.
1474+ */
1475+ int getInconsistencyCounts ( string type ) {
1476+ // total results from all the SSA consistency query predicates.
1477+ type = "Read can be reached from multiple definitions" and
1478+ result =
1479+ count ( Definition def , SourceVariable v , BasicBlock bb , int i | nonUniqueDef ( def , v , bb , i ) )
1480+ or
1481+ type = "Read cannot be reached from a definition" and
1482+ result = count ( SourceVariable v , BasicBlock bb , int i | readWithoutDef ( v , bb , i ) )
1483+ or
1484+ type = "Definition cannot reach a read" and
1485+ result = count ( Definition def , SourceVariable v | deadDef ( def , v ) )
1486+ or
1487+ type = "Read is not dominated by a definition" and
1488+ result =
1489+ count ( Definition def , SourceVariable v , BasicBlock bb , int i |
1490+ notDominatedByDef ( def , v , bb , i )
1491+ )
1492+ or
1493+ type = "End of a basic block can be reached by multiple definitions" and
1494+ result =
1495+ count ( Definition def , SourceVariable v , BasicBlock bb |
1496+ nonUniqueDefReachesEndOfBlock ( def , v , bb )
1497+ )
1498+ or
1499+ type = "Phi node has less than two inputs" and
1500+ result = count ( PhiNode phi , int inputs | uselessPhiNode ( phi , inputs ) )
1501+ or
1502+ type = "Read does not have a prior reference" and
1503+ result = count ( SourceVariable v , BasicBlock bb , int i | readWithoutPriorRef ( v , bb , i ) )
1504+ or
1505+ type = "Read has multiple prior references" and
1506+ result =
1507+ count ( SourceVariable v , BasicBlock bb1 , int i1 , BasicBlock bb2 , int i2 |
1508+ readWithMultiplePriorRefs ( v , bb1 , i1 , bb2 , i2 )
1509+ )
1510+ or
1511+ type = "Phi has less than 2 immediately prior references" and
1512+ result =
1513+ count ( PhiNode phi , BasicBlock bbPhi , SourceVariable v , int inputRefs |
1514+ phiWithoutTwoPriorRefs ( phi , bbPhi , v , inputRefs )
1515+ )
1516+ or
1517+ type = "Phi read has less than 2 immediately prior references" and
1518+ result =
1519+ count ( BasicBlock bbPhi , SourceVariable v , int inputRefs |
1520+ phiReadWithoutTwoPriorRefs ( bbPhi , v , inputRefs )
1521+ )
1522+ }
14711523 }
14721524
14731525 /** Provides the input to `DataFlowIntegration`. */
0 commit comments