Skip to content
  1. May 13, 2020
    • Huber, Joseph's avatar
      OpenMPOpt Remarks Support · 4d4ea9ac
      Huber, Joseph authored
      Reviewed By: jdoerfert
      
      Differential Revision: https://reviews.llvm.org/D79359
      4d4ea9ac
    • Johannes Doerfert's avatar
      [Attributor][FIX] Stabilize the state of AAReturnedValues each update · af48351c
      Johannes Doerfert authored
      For AAReturnedValues we treated new and existing information differently
      in the updateImpl. Only the latter was properly analyzed and
      categorized. The former was thought to be analyzed in the subsequent
      update. Since the Attributor does not support "self-updates" we need to
      make sure the state is "stable" after each updateImpl invocation. That
      is, if the surrounding information does not change, the state is valid.
      Now we make sure all return values have been handled and properly
      categorized each iteration. We might not update again if we have not
      requested a non-fix attribute so we cannot "wait" for the next update to
      analyze a new return value.
      
      Bug reported by @sdmitriev.
      af48351c
  2. May 12, 2020
  3. May 11, 2020
    • Johannes Doerfert's avatar
      [Attributor][FIX] Disallow function signature rewrite for casted calls · 8d94d3c3
      Johannes Doerfert authored
      We will now ensure ensure the return type of called function is the type
      of all call sites we are going to rewrite. This avoids a problem
      partially fixed by D79680. The part that was not covered is a use of
      this "weird" casted call site (see `@func3` in `misc_crash.ll`).
      
      misc_crash.ll checks are auto-generated now.
      8d94d3c3
    • Johannes Doerfert's avatar
      [Attributor] Make AAIsDead dependences optional to prevent top state · c115a78f
      Johannes Doerfert authored
      We should never give up on AAIsDead as it guards other AAs from
      unreachable code (in which SSA properties are meaningless). We did
      however use required dependences on some queries in AAIsDead which
      caused us to invalidate AAIsDead if the queried AA got invalidated.
      We now use optional dependences instead. The bug that exposed this is
      added to the liveness.ll test and other test changes show the impact.
      
      Bug report by @sdmitriev.
      c115a78f
    • Johannes Doerfert's avatar
      [Attributor] Force update of "newly live" abstract attributes · c86fd333
      Johannes Doerfert authored
      During an update of AAIsDead, new instructions become live. If we query
      information from them, the result is often just the initial state, e.g.,
      for call site `noreturn` and `nounwind`. We will now trigger an update
      for cached attributes during the AAIsDead update, though other AAs might
      later use the same API.
      c86fd333
    • Mircea Trofin's avatar
      [llvm][NFC] Move inlining decision-related APIs in InliningAdvisor. · 48fa355e
      Mircea Trofin authored
      Summary: Factoring out in preparation to https://reviews.llvm.org/D79042
      
      Reviewers: dblaikie, davidxl
      
      Subscribers: mgorny, eraman, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79613
      48fa355e
    • Sergey Dmitriev's avatar
      [Attributor] Fix for a crash on RAUW when rewriting function signature · 3df40007
      Sergey Dmitriev authored
      Reviewers: jdoerfert, sstefan1, uenoku
      
      Reviewed By: uenoku
      
      Subscribers: hiraditya, uenoku, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79680
      3df40007
    • OCHyams's avatar
      [NFC][DwarfDebug] Add test for variables with a single location which · da100de0
      OCHyams authored
      don't span their entire scope.
      
      The previous commit (6d1c40c1) is an older version of the test.
      
      Reviewed By: aprantl, vsk
      
      Differential Revision: https://reviews.llvm.org/D79573
      da100de0
    • Xun Li's avatar
      Remove an unused Module param · 44e5aaf9
      Xun Li authored
      Summary:
      In D65848 the function getFuncNameInModule was refactored to no longer use module.
      This diff removes the parameter and rename the function name to avoid confusion.
      
      Reviewers: wenlei, wmi, davidxl
      
      Reviewed By: wenlei
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79310
      44e5aaf9
    • Johannes Doerfert's avatar
      [Attributor] Merge the query set into AbstractAttribute · 3a8740bd
      Johannes Doerfert authored
      The old QuerriedAAs contained two vectors, one for required one for
      optional dependences (=queries). We now use a single vector and encode
      the kind directly in the pointer.
      
      This reduces memory consumption and makes the connection between
      abstract attributes and their dependences clearer.
      
      No functional change is intended, changes in the test are due to
      different order in the query map. Neither the order before nor now is in
      any way special.
      
      ---
      
      Single run of the Attributor module and then CGSCC pass (oldPM)
      for SPASS/clause.c (~10k LLVM-IR loc):
      
      Before:
      ```
      calls to allocation functions: 543734 (329735/s)
      temporary memory allocations: 105895 (64217/s)
      peak heap memory consumption: 19.19MB
      peak RSS (including heaptrack overhead): 102.26MB
      total memory leaked: 269.10KB
      ```
      
      After:
      ```
      calls to allocation functions: 513292 (341511/s)
      temporary memory allocations: 106028 (70544/s)
      peak heap memory consumption: 13.35MB
      peak RSS (including heaptrack overhead): 95.64MB
      total memory leaked: 269.10KB
      ```
      
      Difference:
      ```
      calls to allocation functions: -30442 (208506/s)
      temporary memory allocations: 133 (-910/s)
      peak heap memory consumption: -5.84MB
      peak RSS (including heaptrack overhead): 0B
      total memory leaked: 0B
      ```
      
      ---
      
      Reviewed By: uenoku
      
      Differential Revision: https://reviews.llvm.org/D78729
      3a8740bd
    • Johannes Doerfert's avatar
      [Attributor][FIX] Carefully handle/ignore/forget `argmemonly` · 5e06b251
      Johannes Doerfert authored
      When we have an existing `argmemonly` or `inaccessiblememorargmemonly`
      we used to "know" that information. However, interprocedural constant
      propagation can invalidate these attributes. We now ignore and remove
      these attributes for internal functions (which may be affected by IP
      constant propagation), if we are deriving new attributes for the
      function.
      5e06b251
    • Johannes Doerfert's avatar
      [Attributor] Use "simplify to constant" in genericValueTraversal · 713ee3aa
      Johannes Doerfert authored
      As we replace values with constants interprocedurally, we also need to
      do this "look-through" step during the generic value traversal or we
      would derive properties from replaced values. While this is often not
      problematic, it is when we use the "kind" of a value for reasoning,
      e.g., accesses to arguments allow `argmemonly`.
      713ee3aa
    • Johannes Doerfert's avatar
      [Attributor] Ignore illegal accesses to `null` · 513ac6e9
      Johannes Doerfert authored
      When we categorize a pointer value we bailed at `null` before. If we
      know `null` is not a valid memory location we can ignore it as there
      won't be an access at all.
      513ac6e9
    • Johannes Doerfert's avatar
      [Attributor] Use existing helpers to determine IR facts · 31c03b92
      Johannes Doerfert authored
      We now use getPointerDereferenceableBytes to determine `nonnull` and
      `dereferenceable` facts from the IR. We also use getPointerAlignment in
      AAAlign for the same reason. The latter can interfere with callbacks so
      we do restrict it to non-function-pointers for now.
      31c03b92
    • Johannes Doerfert's avatar
      a9ee8b49
  4. May 08, 2020
    • Johannes Doerfert's avatar
      [Attributor][FIX] Record dependences for assumed dead abstract attributes · edf03914
      Johannes Doerfert authored
      In a recent patch we introduced a problem with abstract attributes that
      were assumed dead at some point. Since `Attributor::updateAA` was
      introduced in 95e0d28b, we did not
      remember the dependence on the liveness AA when an abstract attribute
      was assumed dead and therefore not updated.
      
      Explicit reproducer added in liveness.ll.
      
      ---
      
      Single run of the Attributor module and then CGSCC pass (oldPM)
      for SPASS/clause.c (~10k LLVM-IR loc):
      
      Before:
      ```
      calls to allocation functions: 509242 (345483/s)
      temporary memory allocations: 98666 (66937/s)
      peak heap memory consumption: 18.60MB
      peak RSS (including heaptrack overhead): 103.29MB
      total memory leaked: 269.10KB
      ```
      
      After:
      ```
      calls to allocation functions: 529332 (355494/s)
      temporary memory allocations: 102107 (68574/s)
      peak heap memory consumption: 19.40MB
      peak RSS (including heaptrack overhead): 102.79MB
      total memory leaked: 269.10KB
      ```
      
      Difference:
      ```
      calls to allocation functions: 20090 (1339333/s)
      temporary memory allocations: 3441 (229400/s)
      peak heap memory consumption: 801.45KB
      peak RSS (including heaptrack overhead): 0B
      total memory leaked: 0B
      ```
      edf03914
    • Johannes Doerfert's avatar
      675334da
  5. May 06, 2020
  6. May 05, 2020
    • Kazu Hirata's avatar
      [Inlining] Teach shouldBeDeferred to take the total cost into account · e8984fe6
      Kazu Hirata authored
      Summary:
      This patch teaches shouldBeDeferred to take into account the total
      cost of inlining.
      
      Suppose we have a call hierarchy {A1,A2,A3,...}->B->C.  (Each of A1,
      A2, A3, ... calls B, which in turn calls C.)
      
      Without this patch, shouldBeDeferred essentially returns true if
      
        TotalSecondaryCost < IC.getCost()
      
      where TotalSecondaryCost is the total cost of inlining B into As.
      This means that if B is a small wraper function, for example, it would
      get inlined into all of As.  In turn, C gets inlined into all of As.
      In other words, shouldBeDeferred ignores the cost of inlining C into
      each of As.
      
      This patch adds an option, inline-deferral-scale, to replace the
      expression above with:
      
        TotalCost < Allowance
      
      where
      
      - TotalCost is TotalSecondaryCost + IC.getCost() * # of As, and
      - Allowance is IC.getCost() * Scale
      
      For now, the new option defaults to -1, disabling the new scheme.
      
      Reviewers: davidxl
      
      Subscribers: eraman, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79138
      e8984fe6
    • Arthur Eubanks's avatar
      Remove unnecessary check for inalloca in IPConstantPropagation · d056c0c7
      Arthur Eubanks authored
      Summary:
      This was added in https://reviews.llvm.org/D2449, but I'm not sure it's
      necessary since an inalloca value is never a Constant (should be an
      AllocaInst).
      
      Reviewers: hans, rnk
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79350
      d056c0c7
  7. May 04, 2020
    • Johannes Doerfert's avatar
      [Attributor][NFC] Replace the nested AAMap with a key pair · 14cb0bdf
      Johannes Doerfert authored
      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: 512375 (362871/s)
      temporary memory allocations: 98746 (69933/s)
      peak heap memory consumption: 22.54MB
      peak RSS (including heaptrack overhead): 106.78MB
      total memory leaked: 269.10KB
      ```
      
      After:
      ```
      calls to allocation functions: 509833 (338534/s)
      temporary memory allocations: 98902 (65671/s)
      peak heap memory consumption: 18.71MB
      peak RSS (including heaptrack overhead): 103.00MB
      total memory leaked: 269.10KB
      ```
      
      Difference:
      ```
      calls to allocation functions: -2542 (-27042/s)
      temporary memory allocations: 156 (1659/s)
      peak heap memory consumption: -3.83MB
      peak RSS (including heaptrack overhead): 0B
      total memory leaked: 0B
      ```
      14cb0bdf
    • Johannes Doerfert's avatar
      [Attributor] Remember only necessary dependences · 95e0d28b
      Johannes Doerfert authored
      Before we eagerly put dependences into the QueryMap as soon as we
      encountered them (via `Attributor::getAAFor<>` or
      `Attributor::recordDependence`). Now we will wait to see if the
      dependence is useful, that is if the target is not already in a fixpoint
      state at the end of the update. If so, there is no need to record the
      dependence at all.
      
      Due to the abstraction via `Attributor::updateAA` we will now also treat
      the very first update (during attribute creation) as we do subsequent
      updates.
      
      Finally this resolves the problematic usage of QueriedNonFixAA.
      
      ---
      
      Single run of the Attributor module and then CGSCC pass (oldPM)
      for SPASS/clause.c (~10k LLVM-IR loc):
      
      Before:
      ```
      calls to allocation functions: 554675 (389245/s)
      temporary memory allocations: 101574 (71280/s)
      peak heap memory consumption: 28.46MB
      peak RSS (including heaptrack overhead): 116.26MB
      total memory leaked: 269.10KB
      ```
      
      After:
      ```
      calls to allocation functions: 512465 (345559/s)
      temporary memory allocations: 98832 (66643/s)
      peak heap memory consumption: 22.54MB
      peak RSS (including heaptrack overhead): 106.58MB
      total memory leaked: 269.10KB
      ```
      
      Difference:
      ```
      calls to allocation functions: -42210 (-727758/s)
      temporary memory allocations: -2742 (-47275/s)
      peak heap memory consumption: -5.92MB
      peak RSS (including heaptrack overhead): 0B
      total memory leaked: 0B
      ```
      95e0d28b
    • Johannes Doerfert's avatar
      [Attributor] Inititialize "value attributes" w/ must-be-executed-context info · 231026a5
      Johannes Doerfert authored
      Attributes that only depend on the value (=bit pattern) can be
      initialized from uses in the must-be-executed-context (MBEC). We did use
      `AAComposeTwoGenericDeduction` and `AAFromMustBeExecutedContext` before
      to do this for some positions of these attributes but not for all. This
      was fairly complicated and also problematic as we did run it in every
      `updateImpl` call even though we only use known information. The new
      implementation removes `AAComposeTwoGenericDeduction`* and
      `AAFromMustBeExecutedContext` in favor of a simple interface
      `AddInformation::fromMBEContext(...)` which we call from the
      `initialize` methods of the "value attribute" `Impl` classes, e.g.
      `AANonNullImpl:initialize`.
      
      There can be two types of test changes:
        1) Artifacts were we miss some information that was known before a
           global fixpoint was reached and therefore available in an update
           but not at the beginning.
        2) Deduction for values we did not derive via the MBEC before or which
           were not found as the `AAFromMustBeExecutedContext::updateImpl` was
           never invoked.
      
      * An improved version of AAComposeTwoGenericDeduction can be found in
        D78718. Once we find a new use case that implementation will be able
        to handle "generic" AAs better.
      
      ---
      
      Single run of the Attributor module and then CGSCC pass (oldPM)
      for SPASS/clause.c (~10k LLVM-IR loc):
      
      Before:
      ```
      calls to allocation functions: 468428 (328952/s)
      temporary memory allocations: 77480 (54410/s)
      peak heap memory consumption: 32.71MB
      peak RSS (including heaptrack overhead): 122.46MB
      total memory leaked: 269.10KB
      ```
      
      After:
      ```
      calls to allocation functions: 554720 (351310/s)
      temporary memory allocations: 101650 (64376/s)
      peak heap memory consumption: 28.46MB
      peak RSS (including heaptrack overhead): 116.75MB
      total memory leaked: 269.10KB
      ```
      
      Difference:
      ```
      calls to allocation functions: 86292 (556722/s)
      temporary memory allocations: 24170 (155935/s)
      peak heap memory consumption: -4.25MB
      peak RSS (including heaptrack overhead): 0B
      total memory leaked: 0B
      ```
      
      Reviewed By: uenoku
      
      Differential Revision: https://reviews.llvm.org/D78719
      231026a5
    • Johannes Doerfert's avatar
    • Johannes Doerfert's avatar
      [Attributor][NFC] Proactively ask for `nocapure` on call site arguments · 2f97b8b8
      Johannes Doerfert authored
      This minimizes test noise later on and is in line with other attributes
      we derive proactively.
      2f97b8b8
  8. May 03, 2020
    • Sergey Dmitriev's avatar
      [Attributor] Bitcast constant to the returned value type if it has different type · 0f70f733
      Sergey Dmitriev authored
      Reviewers: jdoerfert, sstefan1, uenoku
      
      Reviewed By: jdoerfert
      
      Subscribers: hiraditya, uenoku, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79277
      0f70f733
    • Mircea Trofin's avatar
      [llvm][NFC] Inliner: factor cost and reporting out of inlining process · bec4ab95
      Mircea Trofin authored
      Summary:
      This factors cost and reporting out of the inlining workflow, thus
      making it easier to reuse when driving inlining from the upcoming
      InliningAdvisor.
      
      Depends on: D79215
      
      Reviewers: davidxl, echristo
      
      Subscribers: eraman, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79275
      bec4ab95
    • 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
  9. May 02, 2020
    • Nikita Popov's avatar
      Remove getNumUses() comparisons (NFC) · b7e23582
      Nikita Popov authored
      getNumUses() scans the full use list. Don't use it is we only want
      to check if there's zero or one uses.
      b7e23582
    • Mircea Trofin's avatar
      [llvm][NFC] Rename variable as per https://reviews.llvm.org/D79215 · 3dbc612c
      Mircea Trofin authored
      Operator error - performed the rename and didn't save.
      3dbc612c
    • Mircea Trofin's avatar
      [llvm][NFC] Inliner: simplify inlining decision logic · e1c4a7cb
      Mircea Trofin authored
      Summary:
      shouldInline makes a decision based on the InlineCost of a call site, as
      well as an evaluation on whether the site should be deferred. This means
      it's possible for the decision to be not to inline, even for an
      InlineCost that would otherwise allow it.
      
      Both uses of shouldInline performed the exact same logic after calling
      it. In addition, the decision on whether to inline or not was
      communicated through two values of the Option<InlineCost> return value:
      None, or an InlineCost evaluating to false.
      
      Simplified by:
      - encapsulating the decision in the return object. The bool it evaluates
      to communicates unambiguously the decision. The InlineCost is also
      available.
      - encapsulated the common post-shouldInline code into shouldInline.
      
      Reviewers: davidxl, echristo, eraman
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79215
      e1c4a7cb
  10. Apr 30, 2020
  11. Apr 29, 2020
Loading