[all-commits] [llvm/llvm-project] a8f1da: [LazyCallGraph] Handle spurious ref edges when del...

aeubanks via All-commits all-commits at lists.llvm.org
Thu Sep 22 15:01:42 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a8f1da128d86d86a3efc1e96e46ace725bf4f3cb
      https://github.com/llvm/llvm-project/commit/a8f1da128d86d86a3efc1e96e46ace725bf4f3cb
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2022-09-22 (Thu, 22 Sep 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/LazyCallGraph.h
    M llvm/lib/Analysis/LazyCallGraph.cpp
    A llvm/test/Analysis/LazyCallGraph/remove-dead-function-spurious-ref-edge.ll
    M llvm/unittests/Analysis/LazyCallGraphTest.cpp

  Log Message:
  -----------
  [LazyCallGraph] Handle spurious ref edges when deleting a dead function

Spurious ref edges are ref edges that still exist in the call graph even
though the corresponding IR reference no longer exists. This can cause
issues when deleting a dead function which has a spurious ref edge
pointed at it because currently we expect the dead function's RefSCC to
be trivial.

In the case that the dead function's RefSCC is not trivial, remove all
ref edges from other nodes in the RefSCC to it.

Removing a ref edge can result in splitting RefSCCs. There's actually no
reason to revisit those RefSCCs because currently we only run passes on
SCCs, and we've already added all SCCs in the RefSCC to the worklist.
(as opposed to removing the ref edge in
updateCGAndAnalysisManagerForPass() which can modify the call graph of
SCCs we have not visited yet). We also don't expect that RefSCC
refinement will allow us to glean any more information for optimization
use. Also, doing so would drastically increase the complexity of
LazyCallGraph::removeDeadFunction(), requiring us to return a list of
invalidated RefSCCs and new RefSCCs to add to the worklist.

Fixes #56503

Reviewed By: asbirlea

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




More information about the All-commits mailing list