@@ -487,7 +487,7 @@ static bool allCallersPassValidPointerForArgument(
487
487
488
488
// Try to prove that all Calls to F do not modify the memory pointed to by Arg,
489
489
// using alias analysis local to each caller of F.
490
- static bool isArgUnmodifiedByAllCalls (Argument *Arg, const LocationSize &Size,
490
+ static bool isArgUnmodifiedByAllCalls (Argument *Arg,
491
491
FunctionAnalysisManager &FAM) {
492
492
for (User *U : Arg->getParent ()->users ()) {
493
493
@@ -499,9 +499,6 @@ static bool isArgUnmodifiedByAllCalls(Argument *Arg, const LocationSize &Size,
499
499
MemoryLocation Loc =
500
500
MemoryLocation::getForArgument (Call, Arg->getArgNo (), nullptr );
501
501
502
- // Refine the MemoryLocation Size using information from Loads of Arg.
503
- Loc = Loc.getWithNewSize (Size);
504
-
505
502
AAResults &AAR = FAM.getResult <AAManager>(*Call->getFunction ());
506
503
// Bail as soon as we find a Call where Arg may be modified.
507
504
if (isModSet (AAR.getModRefInfo (Call, Loc)))
@@ -728,8 +725,7 @@ static bool findArgParts(Argument *Arg, const DataLayout &DL, AAResults &AAR,
728
725
append_range (ArgPartsVec, ArgParts);
729
726
sort (ArgPartsVec, llvm::less_first ());
730
727
731
- // Make sure the parts are non-overlapping. This also computes the size of the
732
- // memory region accessed through Arg.
728
+ // Make sure the parts are non-overlapping.
733
729
int64_t Offset = ArgPartsVec[0 ].first ;
734
730
for (const auto &Pair : ArgPartsVec) {
735
731
if (Pair.first < Offset)
@@ -750,7 +746,7 @@ static bool findArgParts(Argument *Arg, const DataLayout &DL, AAResults &AAR,
750
746
// If we can determine that no call to the Function modifies the memory region
751
747
// accessed through Arg, through alias analysis using actual arguments in the
752
748
// callers, we know that it is guaranteed to be safe to promote the argument.
753
- if (isArgUnmodifiedByAllCalls (Arg, LocationSize::precise (Offset), FAM))
749
+ if (isArgUnmodifiedByAllCalls (Arg, FAM))
754
750
return true ;
755
751
756
752
// Otherwise, use alias analysis to check if the pointer is guaranteed to not
0 commit comments