openbsd-ports/devel/llvm/patches/patch-lib_Transforms_Scalar...

18 lines
747 B
Plaintext

Disable loop idiom recognition for _libc_memset and _libc_memcpy. These are
the internal names we use in libc for memset and memcpy and having the
compiler optimize them as calls to memset and memcpy will lead to infinite
recursion.
Index: lib/Transforms/Scalar/LoopIdiomRecognize.cpp
--- lib/Transforms/Scalar/LoopIdiomRecognize.cpp.orig
+++ lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -367,6 +367,8 @@ bool LoopIdiomRecognize::runOnLoop(Loop *L) {
StringRef Name = L->getHeader()->getParent()->getName();
if (Name == "memset" || Name == "memcpy")
return false;
+ if (Name == "_libc_memset" || Name == "_libc_memcpy")
+ return false;
// Determine if code size heuristics need to be applied.
ApplyCodeSizeHeuristics =