diff options
author | Gui Andrade <gh@archshift.com> | 2021-02-10 18:34:01 -0800 |
---|---|---|
committer | Gui Andrade <gh@archshift.com> | 2021-03-04 12:15:12 -0800 |
commit | 10264a1b21aebf75a8102116c9648c3386e8021e (patch) | |
tree | cd39bbc90d1abb55450807747b66b0950611c089 /clang/lib/CodeGen/CodeGenModule.h | |
parent | 1be97975ccc6d98848868ecb59703156b180b08c (diff) | |
download | llvm-10264a1b21aebf75a8102116c9648c3386e8021e.zip llvm-10264a1b21aebf75a8102116c9648c3386e8021e.tar.gz llvm-10264a1b21aebf75a8102116c9648c3386e8021e.tar.bz2 |
Introduce noundef attribute at call sites for stricter poison analysis
This change adds a new IR noundef attribute, which denotes when a function call argument or return val may never contain uninitialized bits.
In MemorySanitizer, this attribute enables optimizations which decrease instrumented code size by up to 17% (measured with an instrumented build of clang) . I'll introduce the change allowing msan to take advantage of this information in a separate patch.
Differential Revision: https://reviews.llvm.org/D81678
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index d495a16..a224383 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -1374,6 +1374,10 @@ public: void CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, llvm::Function *F); + /// Whether this function's return type has no side effects, and thus may + /// be trivially discarded if it is unused. + bool MayDropFunctionReturn(const ASTContext &Context, QualType ReturnType); + /// Returns whether this module needs the "all-vtables" type identifier. bool NeedAllVtablesTypeId() const; |