[PATCH] D59869: [NewPM] Fix a nasty bug with analysis invalidation in the new PM.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 23:55:38 PDT 2019


chandlerc created this revision.
chandlerc added a reviewer: fedor.sergeev.
Herald added subscribers: jdoerfert, dexonsmith, steven_wu, hiraditya, eraman, mcrosier, mehdi_amini, sanjoy.
Herald added a project: LLVM.

The issue here is that we actually allow CGSCC passes to mutate IR (and
therefore invalidate analyses) outside of the current SCC. At a minimum,
we need to support mutating parent and ancestor SCCs to support the
ArgumentPromotion pass which rewrites all calls to a function.

However, the analysis invalidation infrastructure is heavily based
around not needing to invalidate the same IR-unit at multiple levels.
With Loop passes for example, they don't invalidate other Loops. So we
need to customize how we handle CGSCC invalidation. Doing this without
gratuitously re-running analyses is even harder. I've avoided most of
these by using an out-of-band preserved set to accumulate the cross-SCC
invalidation, but it still isn't perfect in the case of re-visiting the
same SCC repeatedly *but* it coming off the worklist. Unclear how
important this use case really is, but I wanted to call it out.

Another wrinkle is that in order for this to successfully propagate to
function analyses, we have to make sure we have a proxy from the SCC to
the Function level. That requires pre-creating the necessary proxy.

The motivating test case now works cleanly and is added for
ArgumentPromotion.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59869

Files:
  llvm/include/llvm/Analysis/CGSCCPassManager.h
  llvm/lib/Analysis/CGSCCPassManager.cpp
  llvm/test/Other/new-pass-manager.ll
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Transforms/ArgumentPromotion/invalidation.ll
  llvm/test/Transforms/Inline/cgscc-incremental-invalidate.ll
  llvm/unittests/Analysis/CGSCCPassManagerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59869.192414.patch
Type: text/x-patch
Size: 28438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190327/31879b99/attachment-0001.bin>


More information about the llvm-commits mailing list