[all-commits] [llvm/llvm-project] aff058: Reland [CGSCC] Detect devirtualization in more cases

aeubanks via All-commits all-commits at lists.llvm.org
Mon Nov 23 21:29:38 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: aff058b1a92dce2d08974a7d27fa7d032c87601d
      https://github.com/llvm/llvm-project/commit/aff058b1a92dce2d08974a7d27fa7d032c87601d
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2020-11-23 (Mon, 23 Nov 2020)

  Changed paths:
    M llvm/include/llvm/Analysis/CGSCCPassManager.h
    M llvm/lib/Analysis/CGSCCPassManager.cpp
    M llvm/lib/Passes/PassBuilder.cpp
    A llvm/test/Other/devirtualization-undef.ll
    M llvm/test/Transforms/Inline/devirtualize-3.ll
    A llvm/test/Transforms/Inline/devirtualize-5.ll
    A llvm/test/Transforms/Inline/devirtualize-6.ll
    M llvm/test/Transforms/Inline/devirtualize.ll

  Log Message:
  -----------
  Reland [CGSCC] Detect devirtualization in more cases

The devirtualization wrapper misses cases where if it wraps a pass
manager, an individual pass may devirtualize an indirect call created by
a previous pass. For example, inlining may create a new indirect call
which is devirtualized by instcombine. Currently the devirtualization
wrapper will not see that because it only checks cgscc edges at the very
beginning and end of the pass (manager) it wraps.

This fixes some tests testing this exact behavior in the legacy PM.

Instead of checking WeakTrackingVHs for CallBases at the very beginning
and end of the pass it wraps, check every time
updateCGAndAnalysisManagerForPass() is called.

check-llvm and check-clang with -abort-on-max-devirt-iterations-reached
on by default doesn't show any failures outside of tests specifically
testing it so it doesn't needlessly rerun passes more than necessary.
(The NPM -O2/3 pipeline run the inliner/function simplification pipeline
under a devirtualization repeater pass up to 4 times by default).

http://llvm-compile-time-tracker.com/?config=O3&stat=instructions&remote=aeubanks
shows that 7zip has ~1% compile time regression. I looked at it and saw
that there indeed was devirtualization happening that was not previously
caught, so now it reruns the CGSCC pipeline on some SCCs, which is WAI.

The initial land assumed CallBase WeakTrackingVHs would always be
CallBases, but they can be RAUW'd with undef.

Reviewed By: asbirlea

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




More information about the All-commits mailing list