diff options
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())); |