Merge pull request #13031 from hvitved/identity-consistency-check

C#: Remove local identity flow steps
This commit is contained in:
Tom Hvitved
2023-05-15 10:45:35 +02:00
committed by GitHub
23 changed files with 13 additions and 38 deletions

View File

@@ -72,5 +72,5 @@ private class MyConsistencyConfiguration extends ConsistencyConfiguration {
override predicate reverseReadExclude(Node n) { n.asExpr() = any(AwaitExpr ae).getExpr() }
override predicate identityLocalStepExclude(Node n) { n.getLocation().getFile().fromLibrary() }
override predicate identityLocalStepExclude(Node n) { none() }
}

View File

@@ -335,7 +335,8 @@ module LocalFlow {
exists(ControlFlow::BasicBlock bb, int i |
SsaImpl::lastRefBeforeRedefExt(def, bb, i, next.getDefinitionExt()) and
def.definesAt(_, bb, i, _) and
def = getSsaDefinitionExt(nodeFrom)
def = getSsaDefinitionExt(nodeFrom) and
nodeFrom != next
)
}
@@ -414,7 +415,8 @@ module LocalFlow {
) {
exists(CIL::BasicBlock bb, int i | CilSsaImpl::lastRefBeforeRedefExt(def, bb, i, next) |
def.definesAt(_, bb, i, _) and
def = nodeFrom.(CilSsaDefinitionExtNode).getDefinition()
def = nodeFrom.(CilSsaDefinitionExtNode).getDefinition() and
def != next
or
nodeFrom = TCilExprNode(bb.getNode(i).(CIL::ReadAccess))
)
@@ -440,7 +442,8 @@ module LocalFlow {
exists(CIL::ReadAccess readFrom, CIL::ReadAccess readTo |
CilSsaImpl::hasAdjacentReadsExt(def, readFrom, readTo) and
nodeTo = TCilExprNode(readTo) and
nodeFrom = TCilExprNode(readFrom)
nodeFrom = TCilExprNode(readFrom) and
nodeFrom != nodeTo
)
or
// Flow into phi (read) node
@@ -483,7 +486,8 @@ module LocalFlow {
or
hasNodePath(any(LocalExprStepConfiguration x), nodeFrom, nodeTo)
or
ThisFlow::adjacentThisRefs(nodeFrom, nodeTo)
ThisFlow::adjacentThisRefs(nodeFrom, nodeTo) and
nodeFrom != nodeTo
or
ThisFlow::adjacentThisRefs(nodeFrom.(PostUpdateNode).getPreUpdateNode(), nodeTo)
or
@@ -541,7 +545,8 @@ predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
exists(SsaImpl::DefinitionExt def |
LocalFlow::localSsaFlowStepUseUse(def, nodeFrom, nodeTo) and
not FlowSummaryImpl::Private::Steps::prohibitsUseUseFlow(nodeFrom, _) and
not LocalFlow::usesInstanceField(def)
not LocalFlow::usesInstanceField(def) and
nodeFrom != nodeTo
)
or
// Flow into phi (read)/uncertain SSA definition node from read
@@ -880,7 +885,8 @@ private module Cached {
predicate localFlowStepImpl(Node nodeFrom, Node nodeTo) {
LocalFlow::localFlowStepCommon(nodeFrom, nodeTo)
or
LocalFlow::localSsaFlowStepUseUse(_, nodeFrom, nodeTo)
LocalFlow::localSsaFlowStepUseUse(_, nodeFrom, nodeTo) and
nodeFrom != nodeTo
or
exists(SsaImpl::DefinitionExt def |
LocalFlow::localSsaFlowStep(def, nodeFrom, nodeTo) and

View File

@@ -1,7 +0,0 @@
identityLocalStep
| test.cs:17:41:17:44 | this access | Node steps to itself |
| test.cs:34:41:34:44 | this access | Node steps to itself |
| test.cs:52:41:52:44 | this access | Node steps to itself |
| test.cs:67:41:67:44 | this access | Node steps to itself |
| test.cs:77:22:77:24 | this access | Node steps to itself |
| test.cs:90:41:90:44 | this access | Node steps to itself |

View File

@@ -1,2 +0,0 @@
identityLocalStep
| Conditions.cs:133:17:133:22 | [Field1 (line 129): false] this access | Node steps to itself |

View File

@@ -1,2 +0,0 @@
identityLocalStep
| Splitting.cs:133:21:133:29 | [b (line 123): false] this access | Node steps to itself |

View File

@@ -1,7 +0,0 @@
identityLocalStep
| SplittingStressTest.cs:172:16:172:16 | SSA phi read(b29) | Node steps to itself |
| SplittingStressTest.cs:179:13:183:13 | [b1 (line 170): false] SSA phi read(b1) | Node steps to itself |
| SplittingStressTest.cs:184:13:188:13 | [b2 (line 170): false] SSA phi read(b2) | Node steps to itself |
| SplittingStressTest.cs:189:13:193:13 | [b3 (line 170): false] SSA phi read(b3) | Node steps to itself |
| SplittingStressTest.cs:194:13:198:13 | [b4 (line 170): false] SSA phi read(b4) | Node steps to itself |
| SplittingStressTest.cs:199:13:203:13 | [b5 (line 170): false] SSA phi read(b5) | Node steps to itself |

View File

@@ -1,2 +0,0 @@
identityLocalStep
| Test.cs:80:37:80:42 | this access | Node steps to itself |

View File

@@ -1,2 +0,0 @@
identityLocalStep
| GlobalDataFlow.cs:573:9:576:9 | SSA phi read(f) | Node steps to itself |

View File

@@ -1,3 +0,0 @@
identityLocalStep
| DefUse.cs:80:37:80:42 | this access | Node steps to itself |
| Properties.cs:65:24:65:31 | this access | Node steps to itself |

View File

@@ -1,4 +0,0 @@
identityLocalStep
| D.cs:320:17:320:25 | this access | Node steps to itself |
| E.cs:123:21:123:24 | SSA phi read(x) | Node steps to itself |
| E.cs:123:21:123:24 | SSA phi(i) | Node steps to itself |

View File

@@ -1,2 +0,0 @@
identityLocalStep
| ZipSlip.cs:13:13:45:13 | SSA phi read(destDirectory) | Node steps to itself |