[PATCH] D58260: [INLINER] allow inlining of blockaddresses if sole uses are callbrs

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 22 16:53:13 PDT 2019


nickdesaulniers added a comment.

@chandlerc  is the change to llvm/lib/Analysis/CGSCCPassManager.cpp correct?  Otherwise the block in `llvm/include/llvm/Analysis/LazyCallGraph.h` `LazyCallGraph::visitReferences` is suspicious:

  if (BlockAddress *BA = dyn_cast<BlockAddress>(C)) {
    // The blockaddress constant expression is a weird special case, we
    // can't generically walk its operands the way we do for all other
    // constants.
    if (Visited.insert(BA->getFunction()).second)
      Worklist.push_back(BA->getFunction());
    continue;
  }

I suspect that maybe the function shouldn't be added to the worklist if the BA refers to the function it resides in?

`llvm/unittests/Analysis/LazyCallGraphTest.cpp` has a test case `HandleBlockAddress` (`$ ./llvm/build/unittests/Analysis/AnalysisTests --gtest_filter=LazyCallGraphTest.HandleBlockAddress`) that tests block addresses that refer to blocks outside of their own function (that's a case I don't think can be done in C even with GNU C extensions).

TODO: I need to rebase the test case.  `<label>:` are no longer generated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58260/new/

https://reviews.llvm.org/D58260





More information about the llvm-commits mailing list