Skip to content

Commit 9db0f34

Browse files
committed
Remove Size calculation
1 parent 1e43fc2 commit 9db0f34

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

llvm/lib/Transforms/IPO/ArgumentPromotion.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ static bool allCallersPassValidPointerForArgument(
487487

488488
// Try to prove that all Calls to F do not modify the memory pointed to by Arg,
489489
// using alias analysis local to each caller of F.
490-
static bool isArgUnmodifiedByAllCalls(Argument *Arg, const LocationSize &Size,
490+
static bool isArgUnmodifiedByAllCalls(Argument *Arg,
491491
FunctionAnalysisManager &FAM) {
492492
for (User *U : Arg->getParent()->users()) {
493493

@@ -499,9 +499,6 @@ static bool isArgUnmodifiedByAllCalls(Argument *Arg, const LocationSize &Size,
499499
MemoryLocation Loc =
500500
MemoryLocation::getForArgument(Call, Arg->getArgNo(), nullptr);
501501

502-
// Refine the MemoryLocation Size using information from Loads of Arg.
503-
Loc = Loc.getWithNewSize(Size);
504-
505502
AAResults &AAR = FAM.getResult<AAManager>(*Call->getFunction());
506503
// Bail as soon as we find a Call where Arg may be modified.
507504
if (isModSet(AAR.getModRefInfo(Call, Loc)))
@@ -728,8 +725,7 @@ static bool findArgParts(Argument *Arg, const DataLayout &DL, AAResults &AAR,
728725
append_range(ArgPartsVec, ArgParts);
729726
sort(ArgPartsVec, llvm::less_first());
730727

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.
733729
int64_t Offset = ArgPartsVec[0].first;
734730
for (const auto &Pair : ArgPartsVec) {
735731
if (Pair.first < Offset)
@@ -750,7 +746,7 @@ static bool findArgParts(Argument *Arg, const DataLayout &DL, AAResults &AAR,
750746
// If we can determine that no call to the Function modifies the memory region
751747
// accessed through Arg, through alias analysis using actual arguments in the
752748
// 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))
754750
return true;
755751

756752
// Otherwise, use alias analysis to check if the pointer is guaranteed to not

0 commit comments

Comments
 (0)