[llvm] r340052 - [IDF] Teach Iterated Dominance Frontier to use a snapshot CFG based on a GraphDiff.

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 12:23:50 PDT 2018


I can only reproduce it with clang 3.7.0 and clang 3.8.0.  I tried 5.0.0 
and 6.0.1 and they work.  I have a preprocessed file, but it's very 
large.  I opened a bug https://bugs.llvm.org/show_bug.cgi?id=38646 and 
added the zipped file as an attachment there.

This may be a bug in clang, given that it works with newer releases. I 
can upgrade the build compilers on the bots, but it will leave people 
who still use these compilers unable to build LLVM at the moment.

-Krzysztof

On 8/20/2018 1:21 PM, Alina Sbirlea wrote:
> Would you mind giving a pointer on how I can reproduce this failure 
> locally (e.g. flags used)? I hoped r340067 would fix it, but seems not.
> 
> On Mon, Aug 20, 2018 at 10:59 AM Krzysztof Parzyszek 
> <kparzysz at codeaurora.org <mailto:kparzysz at codeaurora.org>> wrote:
> 
>     It seems like this commit broke Hexagon buildbots. Could you take a
>     look?
> 
>     First breakage:
>     http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/19479
> 
>     -Krzysztof
> 
>     On 8/17/2018 12:39 PM, Alina Sbirlea via llvm-commits wrote:
>      > Author: asbirlea
>      > Date: Fri Aug 17 10:39:15 2018
>      > New Revision: 340052
>      >
>      > URL: http://llvm.org/viewvc/llvm-project?rev=340052&view=rev
>      > Log:
>      > [IDF] Teach Iterated Dominance Frontier to use a snapshot CFG
>     based on a GraphDiff.
>      >
>      > Summary:
>      > Create the ability to compute IDF using a CFG View.
>      > For this, we'll need a new DT created using a list of Updates (to
>     be refactored later to a GraphDiff), and the GraphTraits based on
>     the same GraphDiff.
>      >
>      > Reviewers: kuhar, george.burgess.iv, mzolotukhin
>      >
>      > Subscribers: sanjoy, jlebar, llvm-commits
>      >
>      > Differential Revision: https://reviews.llvm.org/D50675
>      >
>      > Modified:
>      >      llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h
>      >      llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp
>      >
>      > Modified:
>     llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h
>      > URL:
>     http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h?rev=340052&r1=340051&r2=340052&view=diff
>      >
>     ==============================================================================
>      > --- llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h
>     (original)
>      > +++ llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h
>     Fri Aug 17 10:39:15 2018
>      > @@ -28,6 +28,7 @@
>      >   #include "llvm/ADT/SmallPtrSet.h"
>      >   #include "llvm/ADT/SmallVector.h"
>      >   #include "llvm/IR/BasicBlock.h"
>      > +#include "llvm/IR/CFGDiff.h"
>      >   #include "llvm/IR/Dominators.h"
>      >
>      >   namespace llvm {
>      > @@ -45,17 +46,21 @@ namespace llvm {
>      >   template <class NodeTy, bool IsPostDom>
>      >   class IDFCalculator {
>      >    public:
>      > -  IDFCalculator(DominatorTreeBase<BasicBlock, IsPostDom> &DT)
>      > -      : DT(DT), useLiveIn(false) {}
>      > +   IDFCalculator(DominatorTreeBase<BasicBlock, IsPostDom> &DT)
>      > +       : DT(DT), GD(nullptr), useLiveIn(false) {}
>      >
>      > -  /// Give the IDF calculator the set of blocks in which the
>     value is
>      > -  /// defined.  This is equivalent to the set of starting blocks
>     it should be
>      > -  /// calculating the IDF for (though later gets pruned based on
>     liveness).
>      > -  ///
>      > -  /// Note: This set *must* live for the entire lifetime of the
>     IDF calculator.
>      > -  void setDefiningBlocks(const SmallPtrSetImpl<BasicBlock *>
>     &Blocks) {
>      > -    DefBlocks = &Blocks;
>      > -  }
>      > +   IDFCalculator(DominatorTreeBase<BasicBlock, IsPostDom> &DT,
>      > +                 GraphDiff<BasicBlock *, IsPostDom> *GD)
>      > +       : DT(DT), GD(GD), useLiveIn(false) {}
>      > +
>      > +   /// Give the IDF calculator the set of blocks in which the
>     value is
>      > +   /// defined.  This is equivalent to the set of starting
>     blocks it should be
>      > +   /// calculating the IDF for (though later gets pruned based
>     on liveness).
>      > +   ///
>      > +   /// Note: This set *must* live for the entire lifetime of the
>     IDF calculator.
>      > +   void setDefiningBlocks(const SmallPtrSetImpl<BasicBlock *>
>     &Blocks) {
>      > +     DefBlocks = &Blocks;
>      > +   }
>      >
>      >     /// Give the IDF calculator the set of blocks in which the
>     value is
>      >     /// live on entry to the block.   This is used to prune the
>     IDF calculation to
>      > @@ -85,6 +90,7 @@ class IDFCalculator {
>      >
>      >   private:
>      >    DominatorTreeBase<BasicBlock, IsPostDom> &DT;
>      > + GraphDiff<BasicBlock *, IsPostDom> *GD;
>      >    bool useLiveIn;
>      >    const SmallPtrSetImpl<BasicBlock *> *LiveInBlocks;
>      >    const SmallPtrSetImpl<BasicBlock *> *DefBlocks;
>      >
>      > Modified: llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp
>      > URL:
>     http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp?rev=340052&r1=340051&r2=340052&view=diff
>      >
>     ==============================================================================
>      > --- llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp (original)
>      > +++ llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp Fri Aug
>     17 10:39:15 2018
>      > @@ -17,6 +17,7 @@
>      >   #include <queue>
>      >
>      >   namespace llvm {
>      > +
>      >   template <class NodeTy, bool IsPostDom>
>      >   void IDFCalculator<NodeTy, IsPostDom>::calculate(
>      >       SmallVectorImpl<BasicBlock *> &PHIBlocks) {
>      > @@ -61,29 +62,39 @@ void IDFCalculator<NodeTy, IsPostDom>::c
>      >         BasicBlock *BB = Node->getBlock();
>      >         // Succ is the successor in the direction we are
>     calculating IDF, so it is
>      >         // successor for IDF, and predecessor for Reverse IDF.
>      > -      for (auto *Succ : children<NodeTy>(BB)) {
>      > +      auto DoWork = [&](BasicBlock *Succ) {
>      >           DomTreeNode *SuccNode = DT.getNode(Succ);
>      >
>      >           // Quickly skip all CFG edges that are also dominator
>     tree edges instead
>      >           // of catching them below.
>      >           if (SuccNode->getIDom() == Node)
>      > -          continue;
>      > +          return;
>      >
>      >           const unsigned SuccLevel = SuccNode->getLevel();
>      >           if (SuccLevel > RootLevel)
>      > -          continue;
>      > +          return;
>      >
>      >           if (!VisitedPQ.insert(SuccNode).second)
>      > -          continue;
>      > +          return;
>      >
>      >           BasicBlock *SuccBB = SuccNode->getBlock();
>      >           if (useLiveIn && !LiveInBlocks->count(SuccBB))
>      > -          continue;
>      > +          return;
>      >
>      >           PHIBlocks.emplace_back(SuccBB);
>      >           if (!DefBlocks->count(SuccBB))
>      >             PQ.push(std::make_pair(
>      >                 SuccNode, std::make_pair(SuccLevel,
>     SuccNode->getDFSNumIn())));
>      > +      };
>      > +
>      > +      if (GD) {
>      > +        for (auto Pair : children<
>      > +                 std::pair<const GraphDiff<BasicBlock *,
>     IsPostDom> *, NodeTy>>(
>      > +                 {GD, BB}))
>      > +          DoWork(Pair.second);
>      > +      } else {
>      > +        for (auto *Succ : children<NodeTy>(BB))
>      > +          DoWork(Succ);
>      >         }
>      >
>      >         for (auto DomChild : *Node) {
>      >
>      >
>      > _______________________________________________
>      > llvm-commits mailing list
>      > llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>      > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>      >
> 
>     -- 
>     Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
>     hosted by The Linux Foundation
> 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation


More information about the llvm-commits mailing list