[Mesa-dev] [PATCH] R600: Fix segfault in R600TextureIntrinsicReplacer

Aaron Watry awatry at gmail.com
Wed Aug 21 14:28:48 PDT 2013


I'm not sure about the lit test, but this definitely made it much more
obvious to me what was failing in my VP8 decoder on R600 in OpenCL.

Old:
Stack dump:
0.    Running pass 'Function Pass Manager' on module 'radeon'.
1.    Running pass 'R600 Texture Intrinsics Replacer' on function
'@vp8_loop_filter_all_edges_kernel'
Segmentation fault (core dumped)

New:
0x3eca3b0: i32 = GlobalAddress<i32 (...)* @write_mem_fence> 0 [ORD=70]
Undefined function
UNREACHABLE executed at
/home/awatry/src/llvm/lib/Target/R600/AMDGPUISelLowering.h:76!
Stack dump:
0.    Running pass 'Function Pass Manager' on module 'radeon'.
1.    Running pass 'AMDGPU DAG->DAG Pattern Instruction Selection' on
function '@vp8_loop_filter_all_edges_kernel'
Aborted (core dumped)

For that you get a:
Tested-By: Aaron Watry <awatry at gmail.com>



On Wed, Aug 21, 2013 at 1:33 PM, Tom Stellard <tom at stellard.net> wrote:
> From: Tom Stellard <thomas.stellard at amd.com>
>
> This pass was segfaulting when it ran into a non-intrinsic function
> call.  Function calls are not supported, so now instead of segfaulting,
> we will get an assertion failure with a nice error message.
>
> I'm not sure how to test this using lit.
> ---
>  lib/Target/R600/R600TextureIntrinsicsReplacer.cpp | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp b/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp
> index 37d9059..d4b8ec0 100644
> --- a/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp
> +++ b/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp
> @@ -260,6 +260,9 @@ public:
>    }
>
>    void visitCallInst(CallInst &I) {
> +    if (!I.getCalledFunction()) {
> +      return;
> +    }
>      StringRef Name = I.getCalledFunction()->getName();
>      if (Name == "llvm.AMDGPU.tex") {
>        ReplaceTexIntrinsic(I, false, TexSign, "llvm.R600.tex", "llvm.R600.texc");
> --
> 1.7.11.4
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


More information about the mesa-dev mailing list