summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2016-12-14 21:57:04 +0000
committerDavide Italiano <davide@freebsd.org>2016-12-14 21:57:04 +0000
commit2ceb628f364bfb2444df6b819ccc22a46fac0a58 (patch)
treeb2771ffd3828ac13417872d3660afaaed4b22795 /llvm/lib
parentdd9688703c0c4df836d0b1ad0d93ccad33c00d2e (diff)
downloadbcm5719-llvm-2ceb628f364bfb2444df6b819ccc22a46fac0a58.tar.gz
bcm5719-llvm-2ceb628f364bfb2444df6b819ccc22a46fac0a58.zip
[LTO] Reject modules without datalayout.
Also, udpate the ~60 failing tests in the tree which did not contain a valid datalayout. This fixes PR31123. lld will be updated in a following patch, immediately after this is committed. Differential Revision: https://reviews.llvm.org/D27082 llvm-svn: 289719
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/LTO/LTO.cpp5
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp1
-rw-r--r--llvm/lib/LTO/LTOModule.cpp1
3 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 718cbf17048..74de6c18aef 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -380,6 +380,11 @@ Error LTO::addModule(InputFile &Input, InputFile::InputModule &IM,
const SymbolResolution *ResE) {
// FIXME: move to backend
Module &M = *IM.Mod;
+
+ if (M.getDataLayoutStr().empty())
+ return make_error<StringError>("input module has no datalayout",
+ inconvertibleErrorCode());
+
if (!Conf.OverrideTriple.empty())
M.setTargetTriple(Conf.OverrideTriple);
else if (M.getTargetTriple().empty())
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 9d4cbdde3ff..87338260998 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -191,7 +191,6 @@ static void runOldPMPasses(Config &Conf, Module &Mod, TargetMachine *TM,
bool opt(Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
bool IsThinLTO) {
- Mod.setDataLayout(TM->createDataLayout());
if (Conf.OptPipeline.empty())
runOldPMPasses(Conf, Mod, TM, IsThinLTO);
else
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index e61a10e5b9e..89aeb800003 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -233,7 +233,6 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options,
TargetMachine *target =
march->createTargetMachine(TripleStr, CPU, FeatureStr, options, None);
- M->setDataLayout(target->createDataLayout());
std::unique_ptr<LTOModule> Ret(new LTOModule(std::move(M), Buffer, target));
Ret->parseSymbols();
OpenPOWER on IntegriCloud