Skip to content
  1. May 03, 2020
    • Florian Hahn's avatar
      bbdfcf8f
    • Johannes Doerfert's avatar
      [Attributor][NFC] Encode IRPositions in the bits of a single pointer · 8228153f
      Johannes Doerfert authored
      This reduces memory consumption for IRPositions by eliminating the
      vtable pointer and the `KindOrArgNo` integer. Since each abstract
      attribute has an associated IRPosition, the 12-16 bytes we save add up
      quickly.
      
      No functional change is intended.
      
      ---
      
      Single run of the Attributor module and then CGSCC pass (oldPM)
      for SPASS/clause.c (~10k LLVM-IR loc):
      
      Before:
      ```
      calls to allocation functions: 469545 (260135/s)
      temporary memory allocations: 77137 (42735/s)
      peak heap memory consumption: 30.50MB
      peak RSS (including heaptrack overhead): 119.50MB
      total memory leaked: 269.07KB
      ```
      
      After:
      ```
      calls to allocation functions: 468999 (274108/s)
      temporary memory allocations: 77002 (45004/s)
      peak heap memory consumption: 28.83MB
      peak RSS (including heaptrack overhead): 118.05MB
      total memory leaked: 269.07KB
      ```
      
      Difference:
      ```
      calls to allocation functions: -546 (5808/s)
      temporary memory allocations: -135 (1436/s)
      peak heap memory consumption: -1.67MB
      peak RSS (including heaptrack overhead): 0B
      total memory leaked: 0B
      ```
      
      ---
      
      CTMark 15 runs
      
      Metric: compile_time
      
      Program                                        lhs    rhs    diff
       test-suite...:: CTMark/sqlite3/sqlite3.test    25.07  24.09 -3.9%
       test-suite...Mark/mafft/pairlocalalign.test    14.58  14.14 -3.0%
       test-suite...-typeset/consumer-typeset.test    21.78  21.58 -0.9%
       test-suite :: CTMark/SPASS/SPASS.test          21.95  22.03  0.4%
       test-suite :: CTMark/lencod/lencod.test        25.43  25.50  0.3%
       test-suite...ark/tramp3d-v4/tramp3d-v4.test    23.88  23.83 -0.2%
       test-suite...TMark/7zip/7zip-benchmark.test    60.24  60.11 -0.2%
       test-suite :: CTMark/kimwitu++/kc.test         15.69  15.69 -0.0%
       test-suite...:: CTMark/ClamAV/clamscan.test    25.43  25.42 -0.0%
       test-suite :: CTMark/Bullet/bullet.test        37.63  37.62 -0.0%
       Geomean difference                                          -0.8%
      
      ---
      
      Reviewed By: lebedev.ri
      
      Differential Revision: https://reviews.llvm.org/D78722
      8228153f
    • Johannes Doerfert's avatar
      [Attributor][NFC] Let AbstractAttribute be an IRPosition · 6bf16ee4
      Johannes Doerfert authored
      Since every AbstractAttribute so far, and for the foreseeable future,
      corresponds to a single IRPosition we can simplify the class structure.
      We already did this for IRAttribute but there is no reason to stop
      there.
      6bf16ee4
    • Mircea Trofin's avatar
    • Sanjay Patel's avatar
      [InstCombine] use select-of-constants with set/clear bit mask patterns · 682f0b36
      Sanjay Patel authored
      Cond ? (X & ~C) : (X | C) --> (X & ~C) | (Cond ? 0 : C)
      Cond ? (X | C) : (X & ~C) --> (X & ~C) | (Cond ? C : 0)
      
      The select-of-constants form results in better codegen.
      There's an existing test diff that shows a transform that
      results in an extra IR instruction, but that's an existing
      problem.
      
      This is motivated by code seen in LLVM itself - see PR37581:
      https://bugs.llvm.org/show_bug.cgi?id=37581
      
      define i8 @src(i8 %x, i8 %C, i1 %b)  {
        %notC = xor i8 %C, -1
        %and = and i8 %x, %notC
        %or = or i8 %x, %C
        %cond = select i1 %b, i8 %or, i8 %and
        ret i8 %cond
      }
      
      define i8 @tgt(i8 %x, i8 %C, i1 %b)  {
        %notC = xor i8 %C, -1
        %and = and i8 %x, %notC
        %mul = select i1 %b, i8 %C, i8 0
        %or = or i8 %mul, %and
        ret i8 %or
      }
      
      http://volta.cs.utah.edu:8080/z/Vt2WVm
      
      Differential Revision: https://reviews.llvm.org/D78880
      682f0b36
  2. May 02, 2020
  3. May 01, 2020
  4. Apr 30, 2020
    • Florian Hahn's avatar
      [LoopVersioning] Update setAliasChecks to take ArrayRef argument (NFC). · 19ab53f1
      Florian Hahn authored
      This cleanup was suggested as part of D78458.
      19ab53f1
    • Nikita Popov's avatar
      [InlineFunction] Disable emission of alignment assumptions by default · b74c6d2c
      Nikita Popov authored
      In D74183 clang started emitting alignment for sret parameters
      unconditionally. This caused a 1.5% compile-time regression on
      tramp3d-v4. The reason is that we now generate many instance of IR like
      
          %ptrint = ptrtoint %class.GuardLayers* %guards_m to i64
          %maskedptr = and i64 %ptrint, 3
          %maskcond = icmp eq i64 %maskedptr, 0
          tail call void @llvm.assume(i1 %maskcond)
      
      to preserve the alignment information during inlining. Based on IR
      analysis, these assumptions also regress optimization. The attached
      phase ordering test case illustrates two issues: One are instruction
      count based optimization heuristics, which are affected by the four
      additional instructions of the assumption. The other is blocking of
      SROA due to ptrtoint casts (PR45763).
      
      We already encountered the same problem in Rust, where we (unlike
      Clang) generally prefer to emit alignment information absolutely
      everywhere it is available. We were only able to do this after
      hardcoding -preserve-alignment-assumptions-during-inlining=false,
      because we were seeing significant optimization and compile-time
      regressions otherwise.
      
      This patch disables -preserve-alignment-assumptions-during-inlining
      by default, because we should not be punishing people for adding
      more alignment annotations.
      
      Once the assume bundle work shakes out and we can represent (and use)
      alignment assumptions using assume bundles, it should be possible to
      re-enable this with reduced overhead.
      
      Differential Revision: https://reviews.llvm.org/D76886
      b74c6d2c
    • Arthur Eubanks's avatar
      [NFC] Rename *ByValOrInalloca* to *PassPointeeByValue* · a90948fd
      Arthur Eubanks authored
      Summary: In preparation for preallocated.
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79152
      a90948fd
    • Jann Horn's avatar
      [AddressSanitizer] Instrument byval call arguments · a2268588
      Jann Horn authored
      Summary:
      In the LLVM IR, "call" instructions read memory for each byval operand.
      For example:
      
      ```
      $ cat blah.c
      struct foo { void *a, *b, *c; };
      struct bar { struct foo foo; };
      void func1(const struct foo);
      void func2(struct bar *bar) { func1(bar->foo); }
      $ [...]/bin/clang -S -flto -c blah.c -O2 ; cat blah.s
      [...]
      define dso_local void @func2(%struct.bar* %bar) local_unnamed_addr #0 {
      entry:
        %foo = getelementptr inbounds %struct.bar, %struct.bar* %bar, i64 0, i32 0
        tail call void @func1(%struct.foo* byval(%struct.foo) align 8 %foo) #2
        ret void
      }
      [...]
      $ [...]/bin/clang -S -c blah.c -O2 ; cat blah.s
      [...]
      func2:                                  # @func2
      [...]
              subq    $24, %rsp
      [...]
              movq    16(%rdi), %rax
              movq    %rax, 16(%rsp)
              movups  (%rdi), %xmm0
              movups  %xmm0, (%rsp)
              callq   func1
              addq    $24, %rsp
      [...]
              retq
      ```
      
      Let ASAN instrument these hidden memory accesses.
      
      This is patch 4/4 of a patch series:
      https://reviews.llvm.org/D77616 [PATCH 1/4] [AddressSanitizer] Refactor ClDebug{Min,Max} handling
      https://reviews.llvm.org/D77617 [PATCH 2/4] [AddressSanitizer] Split out memory intrinsic handling
      https://reviews.llvm.org/D77618 [PATCH 3/4] [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
      https://reviews.llvm.org/D77619 [PATCH 4/4] [AddressSanitizer] Instrument byval call arguments
      
      Reviewers: kcc, glider
      
      Reviewed By: glider
      
      Subscribers: hiraditya, dexonsmith, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77619
      a2268588
    • Jann Horn's avatar
      [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction · cfe36e4c
      Jann Horn authored
      Summary:
      Refactor getInterestingMemoryOperands() so that information about the
      pointer operand is returned through an array of structures instead of
      passing each piece of information separately by-value.
      
      This is in preparation for returning information about multiple pointer
      operands from a single instruction.
      
      A side effect is that, instead of repeatedly generating the same
      information through isInterestingMemoryAccess(), it is now simply collected
      once and then passed around; that's probably more efficient.
      
      HWAddressSanitizer has a bunch of copypasted code from AddressSanitizer,
      so these changes have to be duplicated.
      
      This is patch 3/4 of a patch series:
      https://reviews.llvm.org/D77616 [PATCH 1/4] [AddressSanitizer] Refactor ClDebug{Min,Max} handling
      https://reviews.llvm.org/D77617 [PATCH 2/4] [AddressSanitizer] Split out memory intrinsic handling
      https://reviews.llvm.org/D77618 [PATCH 3/4] [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
      https://reviews.llvm.org/D77619 [PATCH 4/4] [AddressSanitizer] Instrument byval call arguments
      
      [glider: renamed llvm::InterestingMemoryOperand::Type to OpType to fix
      GCC compilation]
      
      Reviewers: kcc, glider
      
      Reviewed By: glider
      
      Subscribers: hiraditya, jfb, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77618
      cfe36e4c
    • Jann Horn's avatar
      [AddressSanitizer] Split out memory intrinsic handling · 223a95fd
      Jann Horn authored
      Summary:
      In both AddressSanitizer and HWAddressSanitizer, we first collect
      instructions whose operands should be instrumented and memory intrinsics,
      then instrument them. Both during collection and when inserting
      instrumentation, they are handled separately.
      
      Collect them separately and instrument them separately. This is a bit
      more straightforward, and prepares for collecting operands instead of
      instructions in a future patch.
      
      This is patch 2/4 of a patch series:
      https://reviews.llvm.org/D77616 [PATCH 1/4] [AddressSanitizer] Refactor ClDebug{Min,Max} handling
      https://reviews.llvm.org/D77617 [PATCH 2/4] [AddressSanitizer] Split out memory intrinsic handling
      https://reviews.llvm.org/D77618 [PATCH 3/4] [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
      https://reviews.llvm.org/D77619 [PATCH 4/4] [AddressSanitizer] Instrument byval call arguments
      
      Reviewers: kcc, glider
      
      Reviewed By: glider
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77617
      223a95fd
    • Jann Horn's avatar
      [AddressSanitizer] Refactor ClDebug{Min,Max} handling · e29996c9
      Jann Horn authored
      Summary:
      A following commit will split the loop over ToInstrument into two.
      To avoid having to duplicate the condition for suppressing instrumentation
      sites based on ClDebug{Min,Max}, refactor it out into a new function.
      
      While we're at it, we can also avoid the indirection through
      NumInstrumented for setting FunctionModified.
      
      This is patch 1/4 of a patch series:
      https://reviews.llvm.org/D77616 [PATCH 1/4] [AddressSanitizer] Refactor ClDebug{Min,Max} handling
      https://reviews.llvm.org/D77617 [PATCH 2/4] [AddressSanitizer] Split out memory intrinsic handling
      https://reviews.llvm.org/D77618 [PATCH 3/4] [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
      https://reviews.llvm.org/D77619 [PATCH 4/4] [AddressSanitizer] Instrument byval call arguments
      
      Reviewers: kcc, glider
      
      Reviewed By: glider
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77616
      e29996c9
    • Alexander Potapenko's avatar
      Revert an accidental commit of four AddressSanitizer refactor CLs · 7e7754df
      Alexander Potapenko authored
      I couldn't make arc land the changes properly, for some reason they all got
      squashed. Reverting them now to land cleanly.
      
      Summary: This reverts commit cfb5f89b.
      
      Reviewers: kcc, thejh
      
      Subscribers:
      7e7754df
    • Jann Horn's avatar
      [AddressSanitizer] Refactor ClDebug{Min,Max} handling · cfb5f89b
      Jann Horn authored
      Summary:
      A following commit will split the loop over ToInstrument into two.
      To avoid having to duplicate the condition for suppressing instrumentation
      sites based on ClDebug{Min,Max}, refactor it out into a new function.
      
      While we're at it, we can also avoid the indirection through
      NumInstrumented for setting FunctionModified.
      
      This is patch 1/4 of a patch series:
      https://reviews.llvm.org/D77616 [PATCH 1/4] [AddressSanitizer] Refactor ClDebug{Min,Max} handling
      https://reviews.llvm.org/D77617 [PATCH 2/4] [AddressSanitizer] Split out memory intrinsic handling
      https://reviews.llvm.org/D77618 [PATCH 3/4] [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
      https://reviews.llvm.org/D77619 [PATCH 4/4] [AddressSanitizer] Instrument byval call arguments
      
      Reviewers: kcc, glider
      
      Reviewed By: glider
      
      Subscribers: jfb, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77616
      cfb5f89b
    • David Spickett's avatar
      [globalopt] Don't emit DWARF fragments for members · 39294293
      David Spickett authored
      of a struct that cover the whole struct
      
      This can happen when the rest of the
      members of are zero length. Following
      the same pattern applied to the SROA
      pass in:
      d7f6f163
      
      Fixes: https://bugs.llvm.org/show_bug.cgi?id=45335
      
      Differential Revision: https://reviews.llvm.org/D78720
      39294293
    • Evgeniy Brevnov's avatar
      [BPI][NFC] IRCE shoud qequest BPI through analysis manager. · 3acf62f3
      Evgeniy Brevnov authored
      Summary: There is no need to create BPI explicitly. It should be requested through AM in a normal way.
      
      Reviewers: skatkov
      
      Reviewed By: skatkov
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79080
      3acf62f3
    • Evgeniy Brevnov's avatar
      [BPI][NFC] Reuse post dominantor tree from analysis manager when available · 3e68a667
      Evgeniy Brevnov authored
      Summary: Currenlty BPI unconditionally creates post dominator tree each time. While this is not incorrect we can save compile time by reusing existing post dominator tree (when it's valid) provided by analysis manager.
      
      Reviewers: skatkov, taewookoh, yrouban
      
      Reviewed By: skatkov
      
      Subscribers: hiraditya, steven_wu, dexonsmith, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D78987
      3e68a667
    • Mircea Trofin's avatar
      [llvm][NFC] Use CallBase explicitly instead of Instruction in FunctionComparator · 3ab319b2
      Mircea Trofin authored
      Reviewers: dblaikie, craig.topper
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79098
      3ab319b2
    • Mircea Trofin's avatar
      [llvm][NFC] Inliner: rename call site variables. · 2c7ff270
      Mircea Trofin authored
      Summary:
      Renamed 'CS' to 'CB', and, in one case, to a more specific name to avoid
      naming collision with outer scope (a maintainability/readability reason,
      not correctness)
      
      Also updated comments.
      
      Reviewers: davidxl, dblaikie, jdoerfert
      
      Subscribers: eraman, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79101
      2c7ff270
  5. Apr 29, 2020
  6. Apr 28, 2020
Loading