Skip to content
Snippets Groups Projects
  1. Apr 15, 2017
    • Vedant Kumar's avatar
      [ubsan] Don't check alignment if the alignment is 1 · e18e320e
      Vedant Kumar authored
      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
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300371 91177308-0d34-0410-b5e6-96231b3b80d8
      e18e320e
    • Vedant Kumar's avatar
      [ubsan] Reduce alignment checking of C++ object pointers · 779dfcce
      Vedant Kumar authored
      This patch teaches ubsan to insert an alignment check for the 'this'
      pointer at the start of each method/lambda. This allows clang to emit
      significantly fewer alignment checks overall, because if 'this' is
      aligned, so are its fields.
      
      This is essentially the same thing r295515 does, but for the alignment
      check instead of the null check. One difference is that we keep the
      alignment checks on member expressions where the base is a DeclRefExpr.
      There's an opportunity to diagnose unaligned accesses in this situation
      (as pointed out by Eli, see PR32630).
      
      Testing: check-clang, check-ubsan, and a stage2 ubsan build.
      
      Along with the patch from D30285, this roughly halves the amount of
      alignment checks we emit when compiling X86FastISel.cpp. Here are the
      numbers from patched/unpatched clangs based on r298160.
      
        ------------------------------------------
        | Setup          | # of alignment checks |
        ------------------------------------------
        | unpatched, -O0 |                 24326 |
        | patched, -O0   |                 12717 | (-47.7%)
        ------------------------------------------
      
      Differential Revision: https://reviews.llvm.org/D30283
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300370 91177308-0d34-0410-b5e6-96231b3b80d8
      779dfcce
  2. Apr 14, 2017
  3. Apr 13, 2017
Loading