@@ -995,7 +995,7 @@ module Internal {
995
995
// pre-SSA predicates
996
996
private module PreCFG {
997
997
private import semmle.code.csharp.controlflow.internal.PreBasicBlocks as PreBasicBlocks
998
- private import semmle.code.csharp.controlflow.internal.PreSsa as PreSsa
998
+ private import semmle.code.csharp.controlflow.internal.PreSsa
999
999
1000
1000
/**
1001
1001
* Holds if pre-basic-block `bb` only is reached when guard `g` has abstract value `v`,
@@ -1081,25 +1081,25 @@ module Internal {
1081
1081
1082
1082
pragma [ noinline]
1083
1083
private predicate conditionalAssign0 (
1084
- Guard guard , AbstractValue vGuard , PreSsa:: Definition def , Expr e , PreSsa:: Definition upd ,
1084
+ Guard guard , AbstractValue vGuard , PreSsa:: PhiNode phi , Expr e , PreSsa:: Definition upd ,
1085
1085
PreBasicBlocks:: PreBasicBlock bbGuard
1086
1086
) {
1087
1087
e = upd .getDefinition ( ) .getSource ( ) and
1088
- upd = def . getAPhiInput ( ) and
1088
+ upd = phi . getAnInput ( ) and
1089
1089
preControlsDirect ( guard , upd .getBasicBlock ( ) , vGuard ) and
1090
1090
bbGuard .getAnElement ( ) = guard and
1091
- bbGuard .strictlyDominates ( def .getBasicBlock ( ) ) and
1092
- not preControlsDirect ( guard , def .getBasicBlock ( ) , vGuard )
1091
+ bbGuard .strictlyDominates ( phi .getBasicBlock ( ) ) and
1092
+ not preControlsDirect ( guard , phi .getBasicBlock ( ) , vGuard )
1093
1093
}
1094
1094
1095
1095
pragma [ noinline]
1096
1096
private predicate conditionalAssign1 (
1097
- Guard guard , AbstractValue vGuard , PreSsa:: Definition def , Expr e , PreSsa:: Definition upd ,
1097
+ Guard guard , AbstractValue vGuard , PreSsa:: PhiNode phi , Expr e , PreSsa:: Definition upd ,
1098
1098
PreBasicBlocks:: PreBasicBlock bbGuard , PreSsa:: Definition other
1099
1099
) {
1100
- conditionalAssign0 ( guard , vGuard , def , e , upd , bbGuard ) and
1100
+ conditionalAssign0 ( guard , vGuard , phi , e , upd , bbGuard ) and
1101
1101
other != upd and
1102
- other = def . getAPhiInput ( )
1102
+ other = phi . getAnInput ( )
1103
1103
}
1104
1104
1105
1105
pragma [ noinline]
@@ -1127,7 +1127,7 @@ module Internal {
1127
1127
) {
1128
1128
conditionalAssign1 ( guard , vGuard , def , e , upd , bbGuard , other ) and
1129
1129
other .getBasicBlock ( ) .dominates ( bbGuard ) and
1130
- not PreSsa :: ssaDefReachesEndOfBlock ( getConditionalSuccessor ( guard , vGuard ) , other , _ )
1130
+ not other . isLiveAtEndOfBlock ( getConditionalSuccessor ( guard , vGuard ) )
1131
1131
}
1132
1132
1133
1133
/**
@@ -1315,14 +1315,14 @@ module Internal {
1315
1315
*/
1316
1316
private PreSsa:: Definition getADefinition ( PreSsa:: Definition def , boolean fromBackEdge ) {
1317
1317
result = def and
1318
- not exists ( def . getAPhiInput ( ) ) and
1318
+ not def instanceof PreSsa :: PhiNode and
1319
1319
fromBackEdge = false
1320
1320
or
1321
1321
exists ( PreSsa:: Definition input , PreBasicBlocks:: PreBasicBlock pred , boolean fbe |
1322
- input = def .getAPhiInput ( )
1322
+ input = def .( PreSsa :: PhiNode ) . getAnInput ( )
1323
1323
|
1324
1324
pred = def .getBasicBlock ( ) .getAPredecessor ( ) and
1325
- PreSsa :: ssaDefReachesEndOfBlock ( pred , input , _ ) and
1325
+ input . isLiveAtEndOfBlock ( pred ) and
1326
1326
result = getADefinition ( input , fbe ) and
1327
1327
( if def .getBasicBlock ( ) .dominates ( pred ) then fromBackEdge = true else fromBackEdge = fbe )
1328
1328
)
@@ -1446,7 +1446,7 @@ module Internal {
1446
1446
private predicate firstReadSameVarUniquePredecesssor (
1447
1447
PreSsa:: Definition def , AssignableRead read
1448
1448
) {
1449
- PreSsa :: firstReadSameVar ( def , read ) and
1449
+ read = def . getAFirstRead ( ) and
1450
1450
not exists ( AssignableRead other | PreSsa:: adjacentReadPairSameVar ( other , read ) |
1451
1451
other != read
1452
1452
)
0 commit comments