[Beignet] [PATCH 02/18] GBE: Remove BBs if it only has a label instruction.

Gong, Zhigang zhigang.gong at intel.com
Wed Apr 2 20:29:18 PDT 2014


> -----Original Message-----
> From: Song, Ruiling
> Sent: Thursday, April 3, 2014 11:24 AM
> To: Zhigang Gong; Gong, Zhigang; beignet at lists.freedesktop.org
> Cc: Gong, Zhigang
> Subject: RE: [Beignet] [PATCH 02/18] GBE: Remove BBs if it only has a label
> instruction.
> 
> What I prefer is after you add a CFG Simplify pass, you can add an assert in the
> backend if we meet empty BB. Suppose this should not occur anymore.
> My concern is we may further gather some CFG info besides "loopInfo" to GEN
> IR. So, when adding new info logic need an extra label Fix here.

That's a valid concern. If we still want to use LLVM's tool to do more things, then we'd
best not to manipulate the CFG manually in this early stage. I will just add an assert there.
Thanks for the comment.

> 
> At least I think you can let removeEmptyLabels() return quickly if there is no
> empty BBs.
> > +        }
> > +        revLabelMap.insert(std::make_pair(next, index));
> > +        insn->remove();
> > +        removeBlock(&BB);
> > +      }
> > +    });
> 
> If no empty BB. Simply return here.
> 
> > +    // fix labels for loops
> > +    for (auto &x : loops) {
> > +      for (auto &y : x->bbs) {
> > +        if (labelMap.find(y) != labelMap.end())
> > +          y = labelMap.find(y)->second;
> > +      }
> > +
> > +      for (auto &z : x->exits) {
> > +        if (labelMap.find(z.first) != labelMap.end())
> > +          z.first = labelMap.find(z.first)->second;
> > +        if (labelMap.find(z.second) != labelMap.end())
> > +          z.second = labelMap.find(z.second)->second;
> > +      }
> > +    }
> > +



More information about the Beignet mailing list