mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-02 17:09:05 +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 llvm-svn: 135286
This commit is contained in:
parent
4cf53f7ec4
commit
bdf65ac132
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user