@@ -319,28 +319,12 @@ private predicate defDependsOnDef(
319319 // Definitions with a defining value.
320320 exists ( Expr expr | assignmentDef ( def , v , expr ) | exprDependsOnDef ( expr , srcDef , srcVar ) )
321321 or
322- exists ( AssignAddExpr assignAdd |
323- def = assignAdd and
322+ // Assignment operations with a defining value
323+ exists ( AssignOperation assignOp |
324+ analyzableExpr ( assignOp ) and
325+ def = assignOp and
324326 def .getAVariable ( ) = v and
325- exprDependsOnDef ( assignAdd .getAnOperand ( ) , srcDef , srcVar )
326- )
327- or
328- exists ( AssignSubExpr assignSub |
329- def = assignSub and
330- def .getAVariable ( ) = v and
331- exprDependsOnDef ( assignSub .getAnOperand ( ) , srcDef , srcVar )
332- )
333- or
334- exists ( UnsignedAssignMulExpr assignMul |
335- def = assignMul and
336- def .getAVariable ( ) = v and
337- exprDependsOnDef ( assignMul .getAnOperand ( ) , srcDef , srcVar )
338- )
339- or
340- exists ( AssignMulByConstantExpr assignMul |
341- def = assignMul and
342- def .getAVariable ( ) = v and
343- exprDependsOnDef ( assignMul .getLValue ( ) , srcDef , srcVar )
327+ exprDependsOnDef ( assignOp , srcDef , srcVar )
344328 )
345329 or
346330 exists ( CrementOperation crem |
@@ -1185,42 +1169,11 @@ private float getDefLowerBoundsImpl(RangeSsaDefinition def, StackVariable v) {
11851169 // Definitions with a defining value.
11861170 exists ( Expr expr | assignmentDef ( def , v , expr ) | result = getFullyConvertedLowerBounds ( expr ) )
11871171 or
1188- exists ( AssignAddExpr assignAdd , RangeSsaDefinition nextDef , float lhsLB , float rhsLB |
1189- def = assignAdd and
1190- assignAdd .getLValue ( ) = nextDef .getAUse ( v ) and
1191- lhsLB = getDefLowerBounds ( nextDef , v ) and
1192- rhsLB = getFullyConvertedLowerBounds ( assignAdd .getRValue ( ) ) and
1193- result = addRoundingDown ( lhsLB , rhsLB )
1194- )
1195- or
1196- exists ( AssignSubExpr assignSub , RangeSsaDefinition nextDef , float lhsLB , float rhsUB |
1197- def = assignSub and
1198- assignSub .getLValue ( ) = nextDef .getAUse ( v ) and
1199- lhsLB = getDefLowerBounds ( nextDef , v ) and
1200- rhsUB = getFullyConvertedUpperBounds ( assignSub .getRValue ( ) ) and
1201- result = addRoundingDown ( lhsLB , - rhsUB )
1202- )
1203- or
1204- exists ( UnsignedAssignMulExpr assignMul , RangeSsaDefinition nextDef , float lhsLB , float rhsLB |
1205- def = assignMul and
1206- assignMul .getLValue ( ) = nextDef .getAUse ( v ) and
1207- lhsLB = getDefLowerBounds ( nextDef , v ) and
1208- rhsLB = getFullyConvertedLowerBounds ( assignMul .getRValue ( ) ) and
1209- result = lhsLB * rhsLB
1210- )
1211- or
1212- exists ( AssignMulByPositiveConstantExpr assignMul , RangeSsaDefinition nextDef , float lhsLB |
1213- def = assignMul and
1214- assignMul .getLValue ( ) = nextDef .getAUse ( v ) and
1215- lhsLB = getDefLowerBounds ( nextDef , v ) and
1216- result = lhsLB * assignMul .getConstant ( )
1217- )
1218- or
1219- exists ( AssignMulByNegativeConstantExpr assignMul , RangeSsaDefinition nextDef , float lhsUB |
1220- def = assignMul and
1221- assignMul .getLValue ( ) = nextDef .getAUse ( v ) and
1222- lhsUB = getDefUpperBounds ( nextDef , v ) and
1223- result = lhsUB * assignMul .getConstant ( )
1172+ // Assignment operations with a defining value
1173+ exists ( AssignOperation assignOp |
1174+ def = assignOp and
1175+ assignOp .getLValue ( ) = v .getAnAccess ( ) and
1176+ result = getTruncatedLowerBounds ( assignOp )
12241177 )
12251178 or
12261179 exists ( IncrementOperation incr , float newLB |
@@ -1249,42 +1202,11 @@ private float getDefUpperBoundsImpl(RangeSsaDefinition def, StackVariable v) {
12491202 // Definitions with a defining value.
12501203 exists ( Expr expr | assignmentDef ( def , v , expr ) | result = getFullyConvertedUpperBounds ( expr ) )
12511204 or
1252- exists ( AssignAddExpr assignAdd , RangeSsaDefinition nextDef , float lhsUB , float rhsUB |
1253- def = assignAdd and
1254- assignAdd .getLValue ( ) = nextDef .getAUse ( v ) and
1255- lhsUB = getDefUpperBounds ( nextDef , v ) and
1256- rhsUB = getFullyConvertedUpperBounds ( assignAdd .getRValue ( ) ) and
1257- result = addRoundingUp ( lhsUB , rhsUB )
1258- )
1259- or
1260- exists ( AssignSubExpr assignSub , RangeSsaDefinition nextDef , float lhsUB , float rhsLB |
1261- def = assignSub and
1262- assignSub .getLValue ( ) = nextDef .getAUse ( v ) and
1263- lhsUB = getDefUpperBounds ( nextDef , v ) and
1264- rhsLB = getFullyConvertedLowerBounds ( assignSub .getRValue ( ) ) and
1265- result = addRoundingUp ( lhsUB , - rhsLB )
1266- )
1267- or
1268- exists ( UnsignedAssignMulExpr assignMul , RangeSsaDefinition nextDef , float lhsUB , float rhsUB |
1269- def = assignMul and
1270- assignMul .getLValue ( ) = nextDef .getAUse ( v ) and
1271- lhsUB = getDefUpperBounds ( nextDef , v ) and
1272- rhsUB = getFullyConvertedUpperBounds ( assignMul .getRValue ( ) ) and
1273- result = lhsUB * rhsUB
1274- )
1275- or
1276- exists ( AssignMulByPositiveConstantExpr assignMul , RangeSsaDefinition nextDef , float lhsUB |
1277- def = assignMul and
1278- assignMul .getLValue ( ) = nextDef .getAUse ( v ) and
1279- lhsUB = getDefUpperBounds ( nextDef , v ) and
1280- result = lhsUB * assignMul .getConstant ( )
1281- )
1282- or
1283- exists ( AssignMulByNegativeConstantExpr assignMul , RangeSsaDefinition nextDef , float lhsLB |
1284- def = assignMul and
1285- assignMul .getLValue ( ) = nextDef .getAUse ( v ) and
1286- lhsLB = getDefLowerBounds ( nextDef , v ) and
1287- result = lhsLB * assignMul .getConstant ( )
1205+ // Assignment operations with a defining value
1206+ exists ( AssignOperation assignOp |
1207+ def = assignOp and
1208+ assignOp .getLValue ( ) = v .getAnAccess ( ) and
1209+ result = getTruncatedUpperBounds ( assignOp )
12881210 )
12891211 or
12901212 exists ( IncrementOperation incr , float newUB |
0 commit comments