diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-02-17 17:36:52 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-02-17 17:36:52 +0000 |
commit | 4f50278f407213101baea0da422566059907f8dd (patch) | |
tree | fa6841dc764ab9bb2291ac88a915c5922f225bd7 /tools/opt | |
parent | 67d9e19554d14ac29148a57774c83b306cc84dbc (diff) |
opt: Rename -default-data-layout flag to -data-layout and make it always override the layout.
There isn't much point in a flag that only works if the data layout is empty.
Differential Revision: https://reviews.llvm.org/D30014
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295468 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt')
-rw-r--r-- | tools/opt/opt.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index d5c74eef700..e61bc915bf8 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -201,10 +201,10 @@ static cl::opt<bool> PrintBreakpoints("print-breakpoints-for-testing", cl::desc("Print select breakpoints location for testing")); -static cl::opt<std::string> -DefaultDataLayout("default-data-layout", - cl::desc("data layout string to use if not specified by module"), - cl::value_desc("layout-string"), cl::init("")); +static cl::opt<std::string> ClDataLayout("data-layout", + cl::desc("data layout string to use"), + cl::value_desc("layout-string"), + cl::init("")); static cl::opt<bool> PreserveBitcodeUseListOrder( "preserve-bc-uselistorder", @@ -448,9 +448,11 @@ int main(int argc, char **argv) { return 1; } - // If we are supposed to override the target triple, do so now. + // If we are supposed to override the target triple or data layout, do so now. if (!TargetTriple.empty()) M->setTargetTriple(Triple::normalize(TargetTriple)); + if (!ClDataLayout.empty()) + M->setDataLayout(ClDataLayout); // Figure out what stream we are supposed to write to... std::unique_ptr<tool_output_file> Out; @@ -530,12 +532,6 @@ int main(int argc, char **argv) { TLII.disableAllFunctions(); Passes.add(new TargetLibraryInfoWrapperPass(TLII)); - // Add an appropriate DataLayout instance for this module. - const DataLayout &DL = M->getDataLayout(); - if (DL.isDefault() && !DefaultDataLayout.empty()) { - M->setDataLayout(DefaultDataLayout); - } - // Add internal analysis passes from the target machine. Passes.add(createTargetTransformInfoWrapperPass(TM ? TM->getTargetIRAnalysis() : TargetIRAnalysis())); |