[PATCH] D25873: [LCSSA] Perform LCSSA verification only for current loop nest

Igor Laevsky via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 10:30:39 PDT 2016


igor-laevsky created this revision.
igor-laevsky added reviewers: mzolotukhin, chandlerc.
igor-laevsky added a subscriber: llvm-commits.

This change continues fixing compile time issues with LCSSA verification (started in  https://reviews.llvm.org/D25364)

Currently after running pass on a single loop-nest we run LCSSA verification for all
loops in the function. This proves to be overly expensive and often not needed since
we were changing only single loop nest. Instead I propose to adopt same technique as was
used for the LoopInfo verification. We will explicitly call LCSSA verification for each
loop nest as part of the LPPassManager iteration.

This is a bit non trivial due to the fact that not all loop passes require LCSSA. See
LoopPassPrinter for example. This means that before doing verification we need to check
if LCSSA was preserved by the current pass. In order to do this we can ask "mustPreserveAnalysisID(LCSSAID)".
Unfortunately LCSSA is part of the TransformsUtils library which depends on Analysis
library and we can't reference LCSSAID without introducing cyclic library dependence.

In order to overcome this problem I had added new analysis pass called "LCSSAVerificationPass".
It's transitively required by the LCSSA transform and preserved by all loop passes. It's
only purpose is to indicate to the LPPassManager when we need to run LCSSA verification
and when we don't.

This solution feels a bit wrong and error prone (it's enough to forget to preserve
LCSSAVerificationPass in order to miss verification). However we discussed this in
the "LCSSA verification for the top-level loops" llvm-dev thread and it seemed like
the best one.


https://reviews.llvm.org/D25873

Files:
  include/llvm/Analysis/LoopPass.h
  include/llvm/InitializePasses.h
  lib/Analysis/Analysis.cpp
  lib/Analysis/LoopPass.cpp
  lib/Transforms/Utils/LCSSA.cpp
  lib/Transforms/Utils/LoopUtils.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25873.75444.patch
Type: text/x-patch
Size: 7149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161021/ea51504d/attachment.bin>


More information about the llvm-commits mailing list