diff options
author | Momchil Velikov <momchil.velikov@arm.com> | 2023-03-30 14:19:23 +0100 |
---|---|---|
committer | Momchil Velikov <momchil.velikov@arm.com> | 2023-03-30 14:38:22 +0100 |
commit | 99e57f06c4df56bc821cd6b6e646886e2e1ee851 (patch) | |
tree | 545f80db70a068f61b246b463e2fe01c2f71fabd /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 3ad167329aafde02e70b0327c0488602111a81ee (diff) | |
download | llvm-99e57f06c4df56bc821cd6b6e646886e2e1ee851.zip llvm-99e57f06c4df56bc821cd6b6e646886e2e1ee851.tar.gz llvm-99e57f06c4df56bc821cd6b6e646886e2e1ee851.tar.bz2 |
[CodeGenPrepare] Increase the limit on the number of instructions to scan
... when finding all memory uses for an address and make it a
parameter.
Now that we have avoided potentially exponential run time of
`FindAllMemoryUses` in D143893. it'd be beneficial to increase the
limit up from 20.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D143894
Change-Id: I3abdf40332ef65e9b2f819ac32ac60e4200ec51d
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index db3aa72..bd00c9f 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -264,6 +264,10 @@ static cl::opt<unsigned> HugeFuncThresholdInCGPP("cgpp-huge-func", cl::init(10000), cl::Hidden, cl::desc("Least BB number of huge function.")); +static cl::opt<unsigned> + MaxAddressUsersToScan("cgp-max-address-users-to-scan", cl::init(100), + cl::Hidden, + cl::desc("Max number of address users to look at")); namespace { enum ExtType { @@ -4961,10 +4965,6 @@ static bool IsOperandAMemoryOperand(CallInst *CI, InlineAsm *IA, Value *OpVal, return true; } -// Max number of memory uses to look at before aborting the search to conserve -// compile time. -static constexpr int MaxMemoryUsesToScan = 20; - /// Recursively walk all the uses of I until we find a memory use. /// If we find an obviously non-foldable instruction, return true. /// Add accessed addresses and types to MemoryUses. @@ -4972,7 +4972,7 @@ static bool FindAllMemoryUses( Instruction *I, SmallVectorImpl<std::pair<Value *, Type *>> &MemoryUses, SmallPtrSetImpl<Instruction *> &ConsideredInsts, const TargetLowering &TLI, const TargetRegisterInfo &TRI, bool OptSize, ProfileSummaryInfo *PSI, - BlockFrequencyInfo *BFI, int &SeenInsts) { + BlockFrequencyInfo *BFI, unsigned &SeenInsts) { // If we already considered this instruction, we're done. if (!ConsideredInsts.insert(I).second) return false; @@ -4985,7 +4985,7 @@ static bool FindAllMemoryUses( for (Use &U : I->uses()) { // Conservatively return true if we're seeing a large number or a deep chain // of users. This avoids excessive compilation times in pathological cases. - if (SeenInsts++ >= MaxMemoryUsesToScan) + if (SeenInsts++ >= MaxAddressUsersToScan) return true; Instruction *UserI = cast<Instruction>(U.getUser()); @@ -5047,7 +5047,7 @@ static bool FindAllMemoryUses( Instruction *I, SmallVectorImpl<std::pair<Value *, Type *>> &MemoryUses, const TargetLowering &TLI, const TargetRegisterInfo &TRI, bool OptSize, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI) { - int SeenInsts = 0; + unsigned SeenInsts = 0; SmallPtrSet<Instruction *, 16> ConsideredInsts; return FindAllMemoryUses(I, MemoryUses, ConsideredInsts, TLI, TRI, OptSize, PSI, BFI, SeenInsts); |