[Beignet] [PATCH V2] GBE: add legalize pass to handle wide integers

Song, Ruiling ruiling.song at intel.com
Sat Oct 11 01:04:31 PDT 2014


> > +
> > +    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;
> > +  }
> > +



More information about the Beignet mailing list