[all-commits] [llvm/llvm-project] 6e9363: [CaptureTracking] Only check reachability for capt...

Nikita Popov via All-commits all-commits at lists.llvm.org
Sat May 15 13:58:17 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6e9363c94230a8427c11c2d13b7c65164370ffae
      https://github.com/llvm/llvm-project/commit/6e9363c94230a8427c11c2d13b7c65164370ffae
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-05-15 (Sat, 15 May 2021)

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

  Log Message:
  -----------
  [CaptureTracking] Only check reachability for capture candidates

Reachability queries are very expensive, and currently performed
for each instruction we look at, even though most of them will
not lead to a capture and are thus ultimately irrelevant. It is
more efficient to walk a few unnecessary instructions than to
perform unnecessary reachability queries.

Theoretically, this may produce worse results, because the additional
instructions considered may cause us to hit the use count limit
earlier. In practice, this does not appear to be a problem, e.g.
on test-suite O3 we report only one more captured-before with this
change, with no resulting codegen differences.

This makes PointerMayBeCapturedBefore() significantly cheaper in
practice, hopefully allowing it to be used in more places.




More information about the All-commits mailing list