[PATCH] [DomTree] Add API forceVerifyDomTree

Philip Reames listmail at philipreames.com
Mon Apr 27 10:04:28 PDT 2015


LGTM.

On 04/15/2015 04:03 PM, Adam Nemet wrote:
> Philip,
>
> Rather than introducing another API flag besides the -verify-dom-info
> command-line flag, I've decided to clean this up.
>
> The new commit log should explain the situation:
>
>    [DomTree] verifyDomTree to unconditionally perform DT verification
>    
>    I folded the check for the flag -verify-dom-info into the only caller
>    where I think it is supposed to be checked: verifyAnalysis.  (The idea
>    of the flag is to enable this expensive verification in
>    verifyPreservedAnalysis.)
>    
>    I'm assuming that when manually scheduling the verification pass with
>    -passes=verify<domtree>, we do want to perform the verification, so I
>    don't check for the flag there.
>
> Please let me know if you're OK with this.
>
> Thanks,
> Adam
>
>
> http://reviews.llvm.org/D8818
>
> Files:
>    lib/IR/Dominators.cpp
>    lib/Transforms/Scalar/PlaceSafepoints.cpp
>
> Index: lib/IR/Dominators.cpp
> ===================================================================
> --- lib/IR/Dominators.cpp
> +++ lib/IR/Dominators.cpp
> @@ -282,9 +282,6 @@
>   }
>   
>   void DominatorTree::verifyDomTree() const {
> -  if (!VerifyDomInfo)
> -    return;
> -
>     Function &F = *getRoot()->getParent();
>   
>     DominatorTree OtherDT;
> @@ -350,7 +347,10 @@
>     return false;
>   }
>   
> -void DominatorTreeWrapperPass::verifyAnalysis() const { DT.verifyDomTree(); }
> +void DominatorTreeWrapperPass::verifyAnalysis() const {
> +    if (VerifyDomInfo)
> +      DT.verifyDomTree();
> +}
>   
>   void DominatorTreeWrapperPass::print(raw_ostream &OS, const Module *) const {
>     DT.print(OS);
> Index: lib/Transforms/Scalar/PlaceSafepoints.cpp
> ===================================================================
> --- lib/Transforms/Scalar/PlaceSafepoints.cpp
> +++ lib/Transforms/Scalar/PlaceSafepoints.cpp
> @@ -448,10 +448,9 @@
>     // Note: SplitBlock modifies the DT.  Simply passing a Pass (which is a
>     // module pass) is not enough.
>     DT.recalculate(F);
> -#ifndef NDEBUG
> +
>     // SplitBlock updates the DT
> -  DT.verifyDomTree();
> -#endif
> +  DEBUG(DT.verifyDomTree());
>   
>     return BB->getTerminator();
>   }
>
> EMAIL PREFERENCES
>    http://reviews.llvm.org/settings/panel/emailpreferences/




More information about the llvm-commits mailing list