mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-15 20:26:36 +00:00
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135286 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
167eb1f903
commit
71400b6afa
@ -173,6 +173,11 @@ static void deleteIfDeadInstruction(Value *V, ScalarEvolution &SE) {
|
|||||||
bool LoopIdiomRecognize::runOnLoop(Loop *L, LPPassManager &LPM) {
|
bool LoopIdiomRecognize::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||||
CurLoop = L;
|
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.
|
// The trip count of the loop must be analyzable.
|
||||||
SE = &getAnalysis<ScalarEvolution>();
|
SE = &getAnalysis<ScalarEvolution>();
|
||||||
if (!SE->hasLoopInvariantBackedgeTakenCount(L))
|
if (!SE->hasLoopInvariantBackedgeTakenCount(L))
|
||||||
|
Loading…
Reference in New Issue
Block a user