diff options
author | Eli Bendersky <eliben@chromium.org> | 2013-06-28 13:25:56 -0700 |
---|---|---|
committer | Eli Bendersky <eliben@chromium.org> | 2013-06-28 13:25:56 -0700 |
commit | 331ef6ecbef4e3f3afa8ae627ad5b3528a534e04 (patch) | |
tree | 4440cd227f449d9d0ac0d7b97accab48a945876f | |
parent | 46f7d96a210d9524fcb050a3e8bf5e0f65081442 (diff) |
Revert the IntrinsicLowering logic that preserves externals for intrinsics.
This is no longer required, following our recent PNaCl ABI cleanups.
BUG=None
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/18031017
-rw-r--r-- | include/llvm/CodeGen/IntrinsicLowering.h | 14 | ||||
-rw-r--r-- | lib/CodeGen/IntrinsicLowering.cpp | 33 | ||||
-rw-r--r-- | tools/lto/LTOCodeGenerator.cpp | 11 | ||||
-rw-r--r-- | tools/lto/LTOModule.cpp | 13 |
4 files changed, 3 insertions, 68 deletions
diff --git a/include/llvm/CodeGen/IntrinsicLowering.h b/include/llvm/CodeGen/IntrinsicLowering.h index 686a9be529..68389dde49 100644 --- a/include/llvm/CodeGen/IntrinsicLowering.h +++ b/include/llvm/CodeGen/IntrinsicLowering.h @@ -16,7 +16,6 @@ #ifndef LLVM_CODEGEN_INTRINSICLOWERING_H #define LLVM_CODEGEN_INTRINSICLOWERING_H -#include "llvm/ADT/StringSet.h" // @LOCALMOD #include "llvm/IR/Intrinsics.h" namespace llvm { @@ -27,23 +26,12 @@ namespace llvm { class IntrinsicLowering { const DataLayout& TD; - static StringSet<> FuncNames; // @LOCALMOD - + bool Warned; public: explicit IntrinsicLowering(const DataLayout &td) : TD(td), Warned(false) {} - /// @LOCALMOD-BEGIN - /// GetFuncNames - Get the names of all functions which may - /// be called by an intrinsic. - static const StringSet<> &GetFuncNames(); - - /// IsCalledByIntrinsic - Returns true if a function may be called - /// by an intrinsic. - static bool IsCalledByIntrinsic(const StringRef &FuncName); - /// @LOCALMOD-END - /// AddPrototypes - This method, if called, causes all of the prototypes /// that might be needed by an intrinsic lowering implementation to be /// inserted into the module specified. diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp index b094fa28e1..07f0ccf52f 100644 --- a/lib/CodeGen/IntrinsicLowering.cpp +++ b/lib/CodeGen/IntrinsicLowering.cpp @@ -92,39 +92,6 @@ static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI, # define setjmp_undefined_for_msvc #endif -// @LOCALMOD-BEGIN -// Calls to these functions may materialize as part of a conversion -// from an intrinsic. -// So if these functions are available in bitcode form we need to: -// * make sure they do not get discarded -- if there is a chance that -// a caller might materialize -// * make sure they do not get specialized for a given callsite -// Both problems are avoided by pretending there are unknown callers. -// The function: IntrinsicLowering::AddPrototypes() below does just that. -// -// We are in the process of removing the need for this list. -// Intrinsics that are truly supported will have versions of these -// functions exported by native libs, so that they can be found. -// Bitcode can then internalize symbols. -static const char *IntrinsicNames[] = { - NULL -}; - -StringSet<> IntrinsicLowering::FuncNames; - -const StringSet<> &IntrinsicLowering::GetFuncNames() { - if (FuncNames.empty()) { - for (unsigned i=0; IntrinsicNames[i]; ++i) - FuncNames.insert(IntrinsicNames[i]); - } - return FuncNames; -} - -bool IntrinsicLowering::IsCalledByIntrinsic(const StringRef &FuncName) { - return IntrinsicLowering::GetFuncNames().count(FuncName) > 0; -} -// @LOCALMOD-END - void IntrinsicLowering::AddPrototypes(Module &M) { LLVMContext &Context = M.getContext(); for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index cb0e41fff5..7a1c48c86c 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -18,7 +18,6 @@ #include "llvm/Analysis/Passes.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/CodeGen/IntrinsicLowering.h" // @LOCALMOD #include "llvm/Config/config.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" @@ -72,16 +71,6 @@ LTOCodeGenerator::LTOCodeGenerator() InitializeAllTargets(); InitializeAllTargetMCs(); InitializeAllAsmPrinters(); - - // @LOCALMOD-BEGIN - // Preserve symbols which may be referenced due to the lowering - // of an intrinsic. - const llvm::StringSet<> &IntrinsicSymbols = IntrinsicLowering::GetFuncNames(); - for (llvm::StringSet<>::const_iterator it = IntrinsicSymbols.begin(), - ie = IntrinsicSymbols.end(); it != ie; ++it) { - _mustPreserveSymbols[it->getKey().str().c_str()] = 1; - } - // @LOCALMOD-END } LTOCodeGenerator::~LTOCodeGenerator() { diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index be407056df..f9257294b1 100644 --- a/tools/lto/LTOModule.cpp +++ b/tools/lto/LTOModule.cpp @@ -16,7 +16,6 @@ #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/Triple.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/CodeGen/IntrinsicLowering.h" // @LOCALMOD #include "llvm/IR/Constants.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" @@ -307,12 +306,6 @@ LTOModule *LTOModule::makeLTOModule(MemoryBuffer *buffer, TargetMachine *target = march->createTargetMachine(TripleStr, CPU, FeatureStr, Options); - // @LOCALMOD-BEGIN - // Add declarations for functions which may be used by intrinsics. - IntrinsicLowering IL(*target->getDataLayout()); - IL.AddPrototypes(*m); - // @LOCALMOD-END - LTOModule *Ret = new LTOModule(m.take(), target); if (Ret->parseSymbols(errMsg)) { delete Ret; @@ -656,10 +649,8 @@ LTOModule::addPotentialUndefinedSymbol(const GlobalValue *decl, bool isFunc) { // @LOCALMOD-BEGIN // Bitcode modules may have declarations for functions or globals // which are unused. Ignore them here so that gold does not mistake - // them for undefined symbols. But don't ignore declarations for - // functions which are potentially used by intrinsics. - if (decl->use_empty() && - !IntrinsicLowering::IsCalledByIntrinsic(decl->getName())) + // them for undefined symbols. + if (decl->use_empty()) return; // @LOCALMOD-END |