File tree 1 file changed +16
-0
lines changed 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -682,6 +682,9 @@ AvarBoundsInference::convergeInferredBounds() {
682
682
return FoundSome;
683
683
}
684
684
685
+ // This function finds all the BoundsKeys (i.e., variables) in
686
+ // scope `DstScope` that are reachable from `FromVarK` in the
687
+ // graph `BKGraph`. All the reachable bounds key will be stored in `PotK`.
685
688
bool AvarBoundsInference::getReachableBoundKeys (const ProgramVarScope *DstScope,
686
689
BoundsKey FromVarK,
687
690
std::set<BoundsKey> &PotK,
@@ -1198,6 +1201,19 @@ void AVarBoundsInfo::getBoundsNeededArrPointers(const std::set<BoundsKey> &ArrPt
1198
1201
std::inserter (AB, AB.end ()));
1199
1202
}
1200
1203
1204
+ // We first propagate all the bounds information from explicit
1205
+ // declarations and mallocs.
1206
+ // For other variables that do not have any choice of bounds,
1207
+ // we use potential bounds choices (FromPB), these are the variables
1208
+ // that are upper bounds to an index variable used in an array indexing
1209
+ // operation.
1210
+ // For example:
1211
+ // if (i < n) {
1212
+ // ...arr[i]...
1213
+ // }
1214
+ // In the above case, we use n as a potential count bounds for arr.
1215
+ // Note: we only use potential bounds for a variable when none of its
1216
+ // predecessors have bounds.
1201
1217
bool AVarBoundsInfo::performFlowAnalysis (ProgramInfo *PI) {
1202
1218
bool RetVal = false ;
1203
1219
AvarBoundsInference ABI (this );
You can’t perform that action at this time.
0 commit comments