summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorSteven Wu <stevenwu@apple.com>2015-07-17 20:09:56 +0000
committerSteven Wu <stevenwu@apple.com>2015-07-17 20:09:56 +0000
commit546a19628bc0d1e1e6b2f50d029df4b08e64dfa5 (patch)
treede33d42a65db7410c59f7987a5f2ff2c873eb8db /clang/lib/Driver/Tools.cpp
parent76c2f2c9dae885fd51971ba8d3b9709355adeade (diff)
downloadbcm5719-llvm-546a19628bc0d1e1e6b2f50d029df4b08e64dfa5.tar.gz
bcm5719-llvm-546a19628bc0d1e1e6b2f50d029df4b08e64dfa5.zip
Fix -save-temp when using objc-arc, sanitizer and profiling
Currently, -save-temp will cause ObjCARC optimization to be dropped, sanitizer pass to run early in the pipeline, and profiling instrumentation to run twice. Fix the issue by properly disable all passes in the optimization pipeline when generating bitcode output and parse some of the Language Options even when the input is bitcode so the passes can be setup correctly. llvm-svn: 242565
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index d4a307b62a4..40643ccb67e 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -4800,7 +4800,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// Forward -Xclang arguments to -cc1, and -mllvm arguments to the LLVM option
// parser.
Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
- bool OptDisabled = false;
for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
A->claim();
@@ -4808,17 +4807,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// it and developers have been trained to spell it with -mllvm.
if (StringRef(A->getValue(0)) == "-disable-llvm-optzns") {
CmdArgs.push_back("-disable-llvm-optzns");
- OptDisabled = true;
} else
A->render(Args, CmdArgs);
}
// With -save-temps, we want to save the unoptimized bitcode output from the
- // CompileJobAction, so disable optimizations if they are not already
- // disabled.
- if (C.getDriver().isSaveTempsEnabled() && !OptDisabled &&
- isa<CompileJobAction>(JA))
- CmdArgs.push_back("-disable-llvm-optzns");
+ // CompileJobAction, use -disable-llvm-passes to get pristine IR generated
+ // by the frontend.
+ if (C.getDriver().isSaveTempsEnabled() && isa<CompileJobAction>(JA))
+ CmdArgs.push_back("-disable-llvm-passes");
if (Output.getType() == types::TY_Dependencies) {
// Handled with other dependency code.
OpenPOWER on IntegriCloud