Remove Debug metadata from copied instruction to prevent Module verification failure
authorSingapuram Sanjay Srivallabh <singapuram.sanjay@gmail.com>
Sat, 29 Jul 2017 18:03:49 +0000 (18:03 +0000)
committerSingapuram Sanjay Srivallabh <singapuram.sanjay@gmail.com>
Sat, 29 Jul 2017 18:03:49 +0000 (18:03 +0000)
commitcf9a8133687a4c4b562e32f300ee65bd6b30d1bf
treea9ad5fb640af4764ef9a9710425242f2bea4dc68
parentce9617f4fe9da8a84c3e16061b4b485e94c446de
Remove Debug metadata from copied instruction to prevent Module 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.

Reviewers: grosser, bollu, Meinersbur

Reviewed By: grosser, bollu

Subscribers: pollydev

Tags: #polly

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

llvm-svn: 309490
polly/lib/CodeGen/BlockGenerators.cpp
polly/test/GPGPU/debug-metadata-leak.ll [new file with mode: 0644]