[llvm] r179499 - Revert "Remove some unused triple and data layout."
Eric Christopher
echristo at gmail.com
Sun Apr 14 16:35:36 PDT 2013
Author: echristo
Date: Sun Apr 14 18:35:36 2013
New Revision: 179499
URL: http://llvm.org/viewvc/llvm-project?rev=179499&view=rev
Log:
Revert "Remove some unused triple and data layout."
This reverts commit r179497 and the accompanying commit as it broke random platforms that aren't osx.
Modified:
llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction.ll
llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction2.ll
llvm/trunk/tools/opt/opt.cpp
Modified: llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction.ll?rev=179499&r1=179498&r2=179499&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction.ll (original)
+++ llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction.ll Sun Apr 14 18:35:36 2013
@@ -1,5 +1,8 @@
; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=i386-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
+target triple = "i386-apple-macosx10.8.0"
+
; int foo(double *A, int n, int m) {
; double sum = 0, v1 = 2, v0 = 3;
; for (int i=0; i < n; ++i)
Modified: llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction2.ll?rev=179499&r1=179498&r2=179499&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction2.ll (original)
+++ llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction2.ll Sun Apr 14 18:35:36 2013
@@ -1,5 +1,8 @@
; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=i386-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
+target triple = "i386-apple-macosx10.8.0"
+
;CHECK: @foo
;CHECK: load <2 x double>
;CHECK: ret
Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=179499&r1=179498&r2=179499&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Sun Apr 14 18:35:36 2013
@@ -36,7 +36,6 @@
#include "llvm/Support/PassNameParser.h"
#include "llvm/Support/PluginLoader.h"
#include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/SystemUtils.h"
@@ -530,8 +529,9 @@ static TargetMachine* GetTargetMachine(T
const Target *TheTarget = TargetRegistry::lookupTarget(MArch, TheTriple,
Error);
// Some modules don't specify a triple, and this is okay.
- if (!TheTarget)
+ if (!TheTarget) {
return 0;
+ }
// Package up features to be passed to target/subtarget
std::string FeaturesStr;
@@ -598,12 +598,9 @@ int main(int argc, char **argv) {
}
// If we are supposed to override the target triple, do so now.
- const DataLayout *TD;
- if (!TargetTriple.empty()) {
+ if (!TargetTriple.empty())
M->setTargetTriple(Triple::normalize(TargetTriple));
- TD = GetTargetMachine(Triple(TargetTriple))->getDataLayout();
- }
-
+
// Figure out what stream we are supposed to write to...
OwningPtr<tool_output_file> Out;
if (NoOutput) {
@@ -644,16 +641,16 @@ int main(int argc, char **argv) {
TLI->disableAllFunctions();
Passes.add(TLI);
- // If we don't have a data layout by now go ahead and set it if we can.
- if (!TD) {
- const std::string &ModuleDataLayout = M.get()->getDataLayout();
- if (!ModuleDataLayout.empty())
- TD = new DataLayout(ModuleDataLayout);
- else if (!DefaultDataLayout.empty())
- TD = new DataLayout(DefaultDataLayout);
- }
+ // Add an appropriate DataLayout instance for this module.
+ DataLayout *TD = 0;
+ const std::string &ModuleDataLayout = M.get()->getDataLayout();
+ if (!ModuleDataLayout.empty())
+ TD = new DataLayout(ModuleDataLayout);
+ else if (!DefaultDataLayout.empty())
+ TD = new DataLayout(DefaultDataLayout);
+
if (TD)
- Passes.add(new DataLayout(*TD));
+ Passes.add(TD);
Triple ModuleTriple(M->getTargetTriple());
TargetMachine *Machine = 0;
More information about the llvm-commits
mailing list