diff options
| author | Vedant Kumar <vsk@apple.com> | 2017-04-14 22:03:37 +0000 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2017-04-14 22:03:37 +0000 |
| commit | 116aebcae07df3c59bf7fcf03fb5bd2cd519277a (patch) | |
| tree | 77c65e8db2a3e201a50d661dfd584aa6f3ae678a /clang/lib | |
| parent | ffd7c887d695433980c4ae7d739c72ae860f5682 (diff) | |
| download | bcm5719-llvm-116aebcae07df3c59bf7fcf03fb5bd2cd519277a.tar.gz bcm5719-llvm-116aebcae07df3c59bf7fcf03fb5bd2cd519277a.zip | |
[ubsan] Don't check alignment if the alignment is 1
If a pointer is 1-byte aligned, there's no use in checking its
alignment. Somewhat surprisingly, ubsan can spend a significant amount
of time doing just that!
This loosely depends on D30283.
Testing: check-clang, check-ubsan, and a stage2 ubsan build.
Differential Revision: https://reviews.llvm.org/D30285
llvm-svn: 300371
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 428c8ffd2a1..265ef27a46b 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -599,7 +599,7 @@ void CodeGenFunction::EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, AlignVal = getContext().getTypeAlignInChars(Ty).getQuantity(); // The glvalue must be suitably aligned. - if (AlignVal) { + if (AlignVal > 1) { llvm::Value *Align = Builder.CreateAnd(Builder.CreatePtrToInt(Ptr, IntPtrTy), llvm::ConstantInt::get(IntPtrTy, AlignVal - 1)); |

