Remove debug metadata from copied instruction to prevent GPUModule verification failure
commit0a68c5ac904b9792b56dd51ba61d6dea124f24dd
authorSingapuram Sanjay Srivallabh <singapuram.sanjay@gmail.com>
Wed, 2 Aug 2017 15:20:07 +0000 (2 15:20 +0000)
committerSingapuram Sanjay Srivallabh <singapuram.sanjay@gmail.com>
Wed, 2 Aug 2017 15:20:07 +0000 (2 15:20 +0000)
tree668f78f2cc14c2239e7cf0ab90937105f6fa990b
parent3cf9252110477c3c8c7de481512488ed6fba2292
Remove debug metadata from copied instruction to prevent GPUModule verification failure

Summary:
**Remove debug metadata from instruction to be copied to prevent the source file's debug metadata being copied into GPUModule and eventually failing Module verification and ASM string codegeneration.**

When copying the instruction onto the Module meant for the GPU, debug metadata attached to an instruction causes all related metadata to be pulled into the Module, including the DICompileUnit, which is not listed in llvm.dbg.cu of the Module. This fails the verification of the Module and generation of the ASM string.

The only debug metadata of the instruction, the DebugLoc, is unset by this patch.

This patch reattempts https://reviews.llvm.org/D35630 by targeting only those instructions that are to end up in a Module meant for the GPU.

Reviewers: grosser, bollu

Reviewed By: grosser

Subscribers: pollydev

Tags: #polly

Differential Revision: https://reviews.llvm.org/D36161

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@309822 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/BlockGenerators.cpp
test/GPGPU/debug-metadata-leak.ll [new file with mode: 0644]