[PATCH] D91327: [NewPM] Redesign of PreserveCFG Checker

Yevgeny Rouban via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 00:59:02 PST 2020


yrouban created this revision.
yrouban added reviewers: skatkov, kuhar, asbirlea, fedor.sergeev.
Herald added subscribers: cfe-commits, wenlei, steven_wu, hiraditya.
Herald added projects: clang, LLVM.
yrouban requested review of this revision.

Please see the reason for this redesign in the patch D91324 <https://reviews.llvm.org/D91324>.
Basically the checker introduces an internal custom CFG analysis that tracks current up-to date CFG snapshot. The analysis is invalidated along with any other CFG related analysis (the key is //CFGAnalyses//). If the CFG analysis is not invalidated at a functional pass exit then the checker asserts that the CFG snapshot taken from this analysis is equals to a snapshot of the current CFG.

Along the way:

- the function //CFG::printDiff()// is simplified by removing function name calculation. The name is printed by the caller;
- fixed CFG invalidated condition (see //CFG::invalidate()//);
- //StandardInstrumentations::registerCallbacks()// gets additional optional parameter of type //FunctionAnalysisManager*//, which is needed by the checker to get the custom CFG analysis;
- several PM related tests updated to ignore lines related to running the custom CFG analysis.

This patch is safe to land as the CFGChecker is left switched off (the options //-verify-cfg-preserved// is false by default). It will be switched on by a separate patch to minimize possible reverts.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91327

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Passes/StandardInstrumentations.h
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Other/loop-pm-invalidation.ll
  llvm/test/Other/new-pass-manager.ll
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Transforms/LoopRotate/pr35210.ll
  llvm/test/Transforms/SCCP/ipsccp-preserve-analysis.ll
  llvm/tools/opt/NewPMDriver.cpp
  llvm/unittests/IR/PassManagerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91327.304741.patch
Type: text/x-patch
Size: 22388 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201112/d2cead80/attachment-0001.bin>


More information about the cfe-commits mailing list