On Sat, Oct 11, 2014 at 02:09:37PM +0800, Ruiling Song wrote:
> This legalize pass will break wider integers like i128/i256/... into shorter 
> ones.
> The problem is how to choose the shorter type? From my observation,
> wide integer type always comes from shorter ones through 'zext' on small type
> or 'bitcast' on vectors, so we simply choose the type where it comes from.
> Then we can split wide integer operations into operations on shorter interger.
> 
> v2:
>   add an assert on the wide integer bit-width, should be power of 2.
>   use rpo_iterator to make sure traverse Value def before its use.
> 
> Signed-off-by: Ruiling Song <[email protected]>
> ---
>  backend/src/CMakeLists.txt            |    1 +
>  backend/src/llvm/llvm_gen_backend.hpp |    3 +
>  backend/src/llvm/llvm_legalize.cpp    |  565 
> +++++++++++++++++++++++++++++++++
>  backend/src/llvm/llvm_to_gen.cpp      |    1 +
>  4 files changed, 570 insertions(+)
>  create mode 100644 backend/src/llvm/llvm_legalize.cpp
> 
> +
> +    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.


> +      }
> +    }
> +
> +    processed.clear();
> +    valueMap.clear();
> +    return changed;
> +  }
> +

_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to