[llvm-commits] [llvm-gcc-4.2] r129344 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Evan Cheng
evan.cheng at apple.com
Mon Apr 11 19:17:41 PDT 2011
Author: evancheng
Date: Mon Apr 11 21:17:41 2011
New Revision: 129344
URL: http://llvm.org/viewvc/llvm-project?rev=129344&view=rev
Log:
Disable loop idiom recognition if -fno-builtin-* options are specified. rdar://9268471
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=129344&r1=129343&r2=129344&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Apr 11 21:17:41 2011
@@ -37,6 +37,7 @@
#include "llvm/CodeGen/RegAllocRegistry.h"
#include "llvm/Target/SubtargetFeature.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegistry.h"
@@ -70,6 +71,7 @@
#include "langhooks.h"
#include "cgraph.h"
#include "params.h"
+#include "c-common.h"
}
// Non-zero if bytecode from PCH is successfully read.
@@ -670,6 +672,19 @@
new FunctionPassManager(TheModule);
PerFunctionPasses->add(new TargetData(*TheTarget->getTargetData()));
+ // Disable (partially) loop idiom pass with -fno-builtin*.
+ TargetLibraryInfo *TLI =
+ new TargetLibraryInfo(Triple(TheModule->getTargetTriple()));
+ if (flag_no_builtin)
+ TLI->disableAllFunctions();
+ else {
+ if (builtin_function_disabled_p("__builtin_memset"))
+ TLI->setUnavailable(LibFunc::memset);
+ if (builtin_function_disabled_p("__builtin_memcpy"))
+ TLI->setUnavailable(LibFunc::memcpy);
+ }
+ PerFunctionPasses->add(TLI);
+
// In -O0 if checking is disabled, we don't even have per-function passes.
bool HasPerFunctionPasses = false;
#ifdef ENABLE_CHECKING
@@ -740,8 +755,21 @@
// FIXME: AT -O0/O1, we should stream out functions at a time.
PerModulePasses = new PassManager();
PerModulePasses->add(new TargetData(*TheTarget->getTargetData()));
- bool HasPerModulePasses = false;
+ // Disable (partially) loop idiom pass with -fno-builtin*.
+ TargetLibraryInfo *TLI =
+ new TargetLibraryInfo(Triple(TheModule->getTargetTriple()));
+ if (flag_no_builtin)
+ TLI->disableAllFunctions();
+ else {
+ if (builtin_function_disabled_p("__builtin_memset"))
+ TLI->setUnavailable(LibFunc::memset);
+ if (builtin_function_disabled_p("__builtin_memcpy"))
+ TLI->setUnavailable(LibFunc::memcpy);
+ }
+ PerModulePasses->add(TLI);
+
+ bool HasPerModulePasses = false;
if (!DisableLLVMOptimizations) {
bool NeedAlwaysInliner = false;
llvm::Pass *InliningPass = 0;
More information about the llvm-commits
mailing list