[Beignet] [PATCH] GBE: skip current BB if it is not in a PN node's incoming BB list.

Zhigang Gong zhigang.gong at linux.intel.com
Tue Apr 7 00:59:36 PDT 2015


This issue is triggered by blender 2.72 CYCLES engine with LLVM 3.5.
It also looks like a LLVM bug for me. Will try to LLVM 3.6 latter.

Thanks for the comment.

On Fri, Apr 03, 2015 at 05:50:30AM +0000, Song, Ruiling wrote:
> 
> 
> > -----Original Message-----
> > From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> > Zhigang Gong
> > Sent: Thursday, April 02, 2015 12:24 PM
> > To: beignet at lists.freedesktop.org
> > Cc: Gong, Zhigang
> > Subject: [Beignet] [PATCH] GBE: skip current BB if it is not in a PN node's
> > incoming BB list.
> > 
> > This is a possible situation especially for a complex switch case lowering.
> 
> Could you give me an example, according to llvm doc @lib/IR/Verifier.cpp
> //  * PHI nodes must have an entry for each predecessor, with no extras.
> 
> I think if you add one verifier pass before genwriter, it could not pass verifier pass.
> Does it occur only on special llvm version?
> 
> Thanks!
> Ruiling
> > 
> > Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
> > ---
> >  backend/src/llvm/llvm_gen_backend.cpp | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/backend/src/llvm/llvm_gen_backend.cpp
> > b/backend/src/llvm/llvm_gen_backend.cpp
> > index 0487bcb..4008704 100644
> > --- a/backend/src/llvm/llvm_gen_backend.cpp
> > +++ b/backend/src/llvm/llvm_gen_backend.cpp
> > @@ -1186,6 +1186,10 @@ namespace gbe
> >    void GenWriter::emitMovForPHI(BasicBlock *curr, BasicBlock *succ) {
> >      for (BasicBlock::iterator I = succ->begin(); isa<PHINode>(I); ++I) {
> >        PHINode *PN = cast<PHINode>(I);
> > +      // If current BB is not in the PN's incomming block list,
> > +      // just skip it here.
> > +      if (PN->getBasicBlockIndex(curr) < 0)
> > +        continue;
> >        Value *IV = PN->getIncomingValueForBlock(curr);
> >        Type *llvmType = PN->getType();
> >        const ir::Type type = getType(ctx, llvmType);
> > --
> > 1.9.1
> > 
> > _______________________________________________
> > Beignet mailing list
> > Beignet at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/beignet
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list