diff options
Diffstat (limited to 'llvm/tools/opt/opt.cpp')
-rw-r--r-- | llvm/tools/opt/opt.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index e03f6cee39f..236c9022587 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -458,7 +458,7 @@ int main(int argc, char **argv) { // Load the input module... std::unique_ptr<Module> M = - parseIRFile(InputFilename, Err, Context, !NoVerify); + parseIRFile(InputFilename, Err, Context, !NoVerify, ClDataLayout); if (!M) { Err.print(argv[0], errs()); @@ -469,6 +469,10 @@ int main(int argc, char **argv) { if (StripDebug) StripDebugInfo(*M); + // If we are supposed to override the target triple or data layout, do so now. + if (!TargetTriple.empty()) + M->setTargetTriple(Triple::normalize(TargetTriple)); + // Immediately run the verifier to catch any problems before starting up the // pass pipelines. Otherwise we can crash on broken code during // doInitialization(). @@ -478,12 +482,6 @@ int main(int argc, char **argv) { return 1; } - // 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<ToolOutputFile> Out; std::unique_ptr<ToolOutputFile> ThinLinkOut; |