[all-commits] [llvm/llvm-project] d5e59e: [ValueTracking] Improve performance of programUnde...

Geza Lore via All-commits all-commits at lists.llvm.org
Mon Oct 31 02:22:24 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d5e59e99f4046a421983f76f5b4c44b646a4af9b
      https://github.com/llvm/llvm-project/commit/d5e59e99f4046a421983f76f5b4c44b646a4af9b
  Author: Geza Lore <gezalore at gmail.com>
  Date:   2022-10-31 (Mon, 31 Oct 2022)

  Changed paths:
    M llvm/lib/Analysis/ValueTracking.cpp

  Log Message:
  -----------
  [ValueTracking] Improve performance of programUndefinedIfUndefOrPoison (NFC)

programUndefinedIfUndefOrPoison used to eagerly propagate the fact that
a value is poison to the users of the value. The problem is that if the
value has a lot of uses (orders of magnitude more than the scanning
limit we use in this function), then we spend the bulk of our time in
eagerly propagating the poison property, which we will mostly never use
later anyway due to the scanning limit.

I have a test case (of ~50k lines of machine generated C++), where this
results in ~60% of 35s compilation time being spent doing just this
eager propagation.

This patch changes programUndefinedIfUndefOrPoison to only propagate to
instructions actually visited, looking back to see if their operands are
poison. This should be equivalent and no functional change is intended,
but we regain virtually all of the 60% compilation time spent in this
function in my test case (i.e.: a 2.5x total compilation speedup).

Differential Revision: https://reviews.llvm.org/D137027




More information about the All-commits mailing list