@@ -160,6 +160,10 @@ private class UnsignedMulExpr extends MulExpr {
160160 UnsignedMulExpr ( ) { this .getType ( ) .( IntegralType ) .isUnsigned ( ) }
161161}
162162
163+ private class UnsignedAssignMulExpr extends AssignMulExpr {
164+ UnsignedAssignMulExpr ( ) { this .getType ( ) .( IntegralType ) .isUnsigned ( ) }
165+ }
166+
163167/** Set of expressions which we know how to analyze. */
164168private predicate analyzableExpr ( Expr e ) {
165169 // The type of the expression must be arithmetic. We reuse the logic in
@@ -190,6 +194,8 @@ private predicate analyzableExpr(Expr e) {
190194 or
191195 e instanceof AssignSubExpr
192196 or
197+ e instanceof UnsignedAssignMulExpr
198+ or
193199 e instanceof CrementOperation
194200 or
195201 e instanceof RemExpr
@@ -249,6 +255,14 @@ private predicate defDependsOnDef(
249255 exprDependsOnDef ( assignSub .getRValue ( ) , srcDef , srcVar )
250256 )
251257 or
258+ exists ( UnsignedAssignMulExpr assignMul , RangeSsaDefinition nextDef |
259+ def = assignMul and
260+ assignMul .getLValue ( ) = nextDef .getAUse ( v )
261+ |
262+ defDependsOnDef ( nextDef , v , srcDef , srcVar ) or
263+ exprDependsOnDef ( assignMul .getRValue ( ) , srcDef , srcVar )
264+ )
265+ or
252266 exists ( CrementOperation crem |
253267 def = crem and
254268 crem .getOperand ( ) = v .getAnAccess ( ) and
@@ -298,6 +312,10 @@ private predicate exprDependsOnDef(Expr e, RangeSsaDefinition srcDef, StackVaria
298312 exprDependsOnDef ( subExpr .getAnOperand ( ) , srcDef , srcVar )
299313 )
300314 or
315+ exists ( UnsignedAssignMulExpr mulExpr | e = mulExpr |
316+ exprDependsOnDef ( mulExpr .getAnOperand ( ) , srcDef , srcVar )
317+ )
318+ or
301319 exists ( CrementOperation crementExpr | e = crementExpr |
302320 exprDependsOnDef ( crementExpr .getOperand ( ) , srcDef , srcVar )
303321 )
@@ -669,6 +687,13 @@ private float getLowerBoundsImpl(Expr expr) {
669687 result = addRoundingDown ( xLow , - yHigh )
670688 )
671689 or
690+ exists ( UnsignedAssignMulExpr mulExpr , float xLow , float yLow |
691+ expr = mulExpr and
692+ xLow = getFullyConvertedLowerBounds ( mulExpr .getLValue ( ) ) and
693+ yLow = getFullyConvertedLowerBounds ( mulExpr .getRValue ( ) ) and
694+ result = xLow * yLow
695+ )
696+ or
672697 exists ( PrefixIncrExpr incrExpr , float xLow |
673698 expr = incrExpr and
674699 xLow = getFullyConvertedLowerBounds ( incrExpr .getOperand ( ) ) and
@@ -845,6 +870,13 @@ private float getUpperBoundsImpl(Expr expr) {
845870 result = addRoundingUp ( xHigh , - yLow )
846871 )
847872 or
873+ exists ( UnsignedAssignMulExpr mulExpr , float xHigh , float yHigh |
874+ expr = mulExpr and
875+ xHigh = getFullyConvertedUpperBounds ( mulExpr .getLValue ( ) ) and
876+ yHigh = getFullyConvertedUpperBounds ( mulExpr .getRValue ( ) ) and
877+ result = xHigh * yHigh
878+ )
879+ or
848880 exists ( PrefixIncrExpr incrExpr , float xHigh |
849881 expr = incrExpr and
850882 xHigh = getFullyConvertedUpperBounds ( incrExpr .getOperand ( ) ) and
@@ -1073,6 +1105,14 @@ private float getDefLowerBoundsImpl(RangeSsaDefinition def, StackVariable v) {
10731105 result = addRoundingDown ( lhsLB , - rhsUB )
10741106 )
10751107 or
1108+ exists ( UnsignedAssignMulExpr assignMul , RangeSsaDefinition nextDef , float lhsLB , float rhsLB |
1109+ def = assignMul and
1110+ assignMul .getLValue ( ) = nextDef .getAUse ( v ) and
1111+ lhsLB = getDefLowerBounds ( nextDef , v ) and
1112+ rhsLB = getFullyConvertedLowerBounds ( assignMul .getRValue ( ) ) and
1113+ result = lhsLB * rhsLB
1114+ )
1115+ or
10761116 exists ( IncrementOperation incr , float newLB |
10771117 def = incr and
10781118 incr .getOperand ( ) = v .getAnAccess ( ) and
@@ -1115,6 +1155,14 @@ private float getDefUpperBoundsImpl(RangeSsaDefinition def, StackVariable v) {
11151155 result = addRoundingUp ( lhsUB , - rhsLB )
11161156 )
11171157 or
1158+ exists ( UnsignedAssignMulExpr assignMul , RangeSsaDefinition nextDef , float lhsUB , float rhsUB |
1159+ def = assignMul and
1160+ assignMul .getLValue ( ) = nextDef .getAUse ( v ) and
1161+ lhsUB = getDefUpperBounds ( nextDef , v ) and
1162+ rhsUB = getFullyConvertedUpperBounds ( assignMul .getRValue ( ) ) and
1163+ result = lhsUB * rhsUB
1164+ )
1165+ or
11181166 exists ( IncrementOperation incr , float newUB |
11191167 def = incr and
11201168 incr .getOperand ( ) = v .getAnAccess ( ) and
0 commit comments