summaryrefslogtreecommitdiff
path: root/tools/llc/llc.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2012-08-03 21:26:18 +0000
committerBob Wilson <bob.wilson@apple.com>2012-08-03 21:26:18 +0000
commit772af92cb16a5e11bd580f576643a6268e8a5bce (patch)
tree1203a6feff2d18cf8952074c01ec6c7ca63c97f3 /tools/llc/llc.cpp
parentb2beac2b9671f7d9773329d62c2821c8ac449ac5 (diff)
Fix memcmp code-gen to honor -fno-builtin.
I noticed that SelectionDAGBuilder::visitCall was missing a check for memcmp in TargetLibraryInfo, so that it would use custom code for memcmp calls even with -fno-builtin. I also had to add a new -disable-simplify-libcalls option to llc so that I could write a test for this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llc/llc.cpp')
-rw-r--r--tools/llc/llc.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 004763f19fa..8951050c07c 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -35,6 +35,7 @@
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Target/TargetMachine.h"
#include <memory>
using namespace llvm;
@@ -214,6 +215,11 @@ DontPlaceZerosInBSS("nozero-initialized-in-bss",
cl::init(false));
static cl::opt<bool>
+DisableSimplifyLibCalls("disable-simplify-libcalls",
+ cl::desc("Disable simplify-libcalls"),
+ cl::init(false));
+
+static cl::opt<bool>
EnableGuaranteedTailCallOpt("tailcallopt",
cl::desc("Turn fastcc calls into tail calls by (potentially) changing ABI."),
cl::init(false));
@@ -487,6 +493,12 @@ int main(int argc, char **argv) {
// Build up all of the passes that we want to do to the module.
PassManager PM;
+ // Add an appropriate TargetLibraryInfo pass for the module's triple.
+ TargetLibraryInfo *TLI = new TargetLibraryInfo(TheTriple);
+ if (DisableSimplifyLibCalls)
+ TLI->disableAllFunctions();
+ PM.add(TLI);
+
// Add the target data from the target machine, if it exists, or the module.
if (const TargetData *TD = Target.getTargetData())
PM.add(new TargetData(*TD));