diff options
author | Vitaly Buka <vitalybuka@google.com> | 2019-08-26 22:15:50 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2019-08-26 22:15:50 +0000 |
commit | aeca56964f917e5e6faaf291dfd29f3875236ca0 (patch) | |
tree | 605dc6d34d754627b80fc3f4570b757de8c6de5e /clang/lib/CodeGen | |
parent | 173a3a54bba06ffbf2b680cf52f1f8a257c33b15 (diff) | |
download | bcm5719-llvm-aeca56964f917e5e6faaf291dfd29f3875236ca0.tar.gz bcm5719-llvm-aeca56964f917e5e6faaf291dfd29f3875236ca0.zip |
msan, codegen, instcombine: Keep more lifetime markers used for msan
Reviewers: eugenis
Subscribers: hiraditya, cfe-commits, #sanitizers, llvm-commits
Tags: #clang, #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D66695
llvm-svn: 369979
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 7 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 10 |
2 files changed, 6 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index d53fb46f336..0e04a514565 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -516,13 +516,12 @@ EmitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *M) { // Avoid creating a conditional cleanup just to hold an llvm.lifetime.end // marker. Instead, start the lifetime of a conditional temporary earlier - // so that it's unconditional. Don't do this in ASan's use-after-scope - // mode so that it gets the more precise lifetime marks. If the type has - // a non-trivial destructor, we'll have a cleanup block for it anyway, - // so this typically doesn't help; skip it in that case. + // so that it's unconditional. Don't do this with sanitizers which need + // more precise lifetime marks. ConditionalEvaluation *OldConditional = nullptr; CGBuilderTy::InsertPoint OldIP; if (isInConditionalBranch() && !E->getType().isDestructedType() && + !SanOpts.has(SanitizerKind::Memory) && !CGM.getCodeGenOpts().SanitizeAddressUseAfterScope) { OldConditional = OutermostConditional; OutermostConditional = nullptr; diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 95b8fdce783..228093044e1 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -47,13 +47,9 @@ static bool shouldEmitLifetimeMarkers(const CodeGenOptions &CGOpts, if (CGOpts.DisableLifetimeMarkers) return false; - // Disable lifetime markers in msan builds. - // FIXME: Remove this when msan works with lifetime markers. - if (LangOpts.Sanitize.has(SanitizerKind::Memory)) - return false; - - // Asan uses markers for use-after-scope checks. - if (CGOpts.SanitizeAddressUseAfterScope) + // Sanitizers may use markers. + if (CGOpts.SanitizeAddressUseAfterScope || + LangOpts.Sanitize.has(SanitizerKind::Memory)) return true; // For now, only in optimized builds. |