diff options
| author | Chad Rosier <mcrosier@apple.com> | 2011-07-15 18:25:04 +0000 | 
|---|---|---|
| committer | Chad Rosier <mcrosier@apple.com> | 2011-07-15 18:25:04 +0000 | 
| commit | a7ff54351a782dd8a83a24e03db828cd6f4010b4 (patch) | |
| tree | 8b7aeaeaa7b1006d591f09b550c16da3e7255c50 /llvm | |
| parent | 4921fe2f9e5aeed0006a14d4e4d0755e4006d467 (diff) | |
| download | bcm5719-llvm-a7ff54351a782dd8a83a24e03db828cd6f4010b4.tar.gz bcm5719-llvm-a7ff54351a782dd8a83a24e03db828cd6f4010b4.zip  | |
Disable loop idiom recognition of memset/memcpy if the function being compiled
is named after a common idiom (i.e., memset/memcpy).  Otherwise, we can run into 
infinite recursion.  Ideally, the user should use the correct -fno-builtin flag,
but in case they don't we should play nicely.
rdar://9763412
llvm-svn: 135286
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 5 | 
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index a7bc0e0b437..a0e41d9a977 100644 --- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -173,6 +173,11 @@ static void deleteIfDeadInstruction(Value *V, ScalarEvolution &SE) {  bool LoopIdiomRecognize::runOnLoop(Loop *L, LPPassManager &LPM) {    CurLoop = L; +  // Disable loop idiom recognition if the function's name is a common idiom.  +  StringRef Name = L->getHeader()->getParent()->getName(); +  if (Name == "memset" || Name == "memcpy") +    return false; +    // The trip count of the loop must be analyzable.    SE = &getAnalysis<ScalarEvolution>();    if (!SE->hasLoopInvariantBackedgeTakenCount(L))  | 

