[PATCH] D29006: [PH] Remove all use of AssertingVH from members of analysis results.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 01:45:05 PST 2017


chandlerc created this revision.
Herald added subscribers: mzolotukhin, mcrosier.

These are fundamentally incompatible with cache-invalidation of analysis
results. The invaliadtion happens after the AssertingVH has already
fired. There are more appropriate tools to use in these scenarios if and
when someone needs them to debug things. For example, a debug-build-only
WeakVH and an explicit assert that it hasn't gone null when it is *used*
so that it can still *exist* even when the value goes away.

This patch also removes all of the (numerous) doomed attempts to work
around this fundamental incompatibility. It is a pretty significant
simplification IMO.

The most interesting change is in the Inliner where we still do some
clearing because we don't want to rely on the coarse grained
invalidation strategy of the containing pass manager. However, I prefer
the approach that contains this logic to the cleanup phase of the
Inliner, and I think we could enhance the CGSCC analysis management
layer to make this even better in the future if desired.

The rest is straight cleanup.

I've also added a test for one of the harder cases to work around: when
a *module analysis* contains many AssertingVHes pointing at functions.

Note that this remains a bit controversial. See the llvm-dev discussion here:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/109394.html


https://reviews.llvm.org/D29006

Files:
  include/llvm/Analysis/CallGraph.h
  include/llvm/Analysis/ScalarEvolution.h
  lib/Analysis/LazyValueInfo.cpp
  lib/Transforms/IPO/FunctionAttrs.cpp
  lib/Transforms/IPO/GlobalDCE.cpp
  lib/Transforms/IPO/Inliner.cpp
  lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
  lib/Transforms/Scalar/NaryReassociate.cpp
  lib/Transforms/Utils/LoopSimplify.cpp
  test/Other/new-pm-defaults.ll
  test/Transforms/GlobalDCE/crash-assertingvh.ll
  test/Transforms/Inline/clear-analyses.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29006.85330.patch
Type: text/x-patch
Size: 11845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170123/31a976bb/attachment.bin>


More information about the llvm-commits mailing list