forked from OSchip/llvm-project
Upgrade BasicAliasAnalysis::getModRefBehavior to not call Value::getName,
which dynamically allocates the string result. This speeds up dse on the testcase from PR1432 from 0.3781s to 0.1804s (2.1x). llvm-svn: 40838
This commit is contained in:
parent
44f7d3aa0b
commit
6493fc79fe
|
@ -24,6 +24,7 @@
|
|||
#include "llvm/Pass.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
|
@ -900,17 +901,26 @@ BasicAliasAnalysis::getModRefBehavior(Function *F, CallSite CS,
|
|||
StringCompare());
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
ValueName *Name = F->getValueName();
|
||||
unsigned NameLen = Name->getKeyLength();
|
||||
const char *NamePtr = Name->getKeyData();
|
||||
|
||||
// If there is an embedded nul character in the function name, we can never
|
||||
// match it.
|
||||
if (strlen(NamePtr) != NameLen)
|
||||
return UnknownModRefBehavior;
|
||||
|
||||
std::vector<const char*>::iterator Ptr =
|
||||
std::lower_bound(NoMemoryTable->begin(), NoMemoryTable->end(),
|
||||
F->getName().c_str(), StringCompare());
|
||||
if (Ptr != NoMemoryTable->end() && *Ptr == F->getName())
|
||||
NamePtr, StringCompare());
|
||||
if (Ptr != NoMemoryTable->end() && strcmp(*Ptr, NamePtr) == 0)
|
||||
return DoesNotAccessMemory;
|
||||
|
||||
Ptr = std::lower_bound(OnlyReadsMemoryTable->begin(),
|
||||
OnlyReadsMemoryTable->end(),
|
||||
F->getName().c_str(), StringCompare());
|
||||
if (Ptr != OnlyReadsMemoryTable->end() && *Ptr == F->getName())
|
||||
NamePtr, StringCompare());
|
||||
if (Ptr != OnlyReadsMemoryTable->end() && strcmp(*Ptr, NamePtr) == 0)
|
||||
return OnlyReadsMemory;
|
||||
|
||||
return UnknownModRefBehavior;
|
||||
|
|
Loading…
Reference in New Issue