Just pushed the patchset with this modification.
Thanks.

On Sat, Oct 11, 2014 at 08:04:31AM +0000, Song, Ruiling wrote:
> > > +
> > > +    for (Value *v : processed) {
> > > +      if (isa<Instruction>(v)) {
> > > +        dyn_cast<Instruction>(v)->eraseFromParent();
> > 
> > segfault at the above line when run utest builtin_ilogb_float16:
> >   builtin_ilogb_float16()While deleting: i512 %uret.sroa.0.44.insert.ext.i
> >   Use still stuck around after Def is destroyed:  
> > %uret.sroa.0.44.insert.ext.i
> > = zext i32 %conv.i.i40.i to i512
> > 
> > The root cause should be that the instructions in processed set may use
> > valuses in the same set. When erase the def before the use, it trigger this
> > assert.
> 
> Yes, I didn't notice this, when eraseFromParent(), we should make sure its 
> references are empty.
> To fix this issue. We should do like below:
> +    for (Value *v : processed) {
>  +      if (isa<Instruction>(v)) {
>  +        dyn_cast<Instruction>(v)->dropAllReferences();
>  +     }
>  +    for (Value *v : processed) {
>  +      if (isa<Instruction>(v)) {
>  +        dyn_cast<Instruction>(v)->eraseFromParent();
>  +     }
> > 
> > 
> > > +      }
> > > +    }
> > > +
> > > +    processed.clear();
> > > +    valueMap.clear();
> > > +    return changed;
> > > +  }
> > > +
> 
> _______________________________________________
> Beignet mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/beignet
_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to