llvm-project/polly/lib/CodeGen
David Peixotto a4817871d2 Safely generate new loop metadata node
Polly was accidently modifying a debug info metadata node when
attempting to generate a new unique metadata node for the loop id.
The problem was that we had dwarf metadata that referred to a
metadata node with a null value, like this:

  !6 = ... some dwarf metadata referring to !7 ...
  !7 = {null}

When we attempt to generate a new metadata node, we reserve the
first space for self-referential node by setting the first argument
to null and then mutating the node later to refer to itself.
However, because the nodes are uniqued based on pointer values, when
we get the new metadata node it actually referred to an existing
node (!7 in the example).  When we went to modify the metadata to
point to itself, we were accidently mutating the dwarf metatdata. We
ended up in this situation:

  !6 = ... some dwarf metadata referring to !7 ...
  !7 = {!7}

and this causes an assert when generating the debug info. The fix is
simple, we just need to use a unique value when getting a new
metadata node. The MDNode::getTemporary() provides exactly the API
we need (and it is used in clang to generate the unique nodes).

Differential Revision: http://reviews.llvm.org/D6174

llvm-svn: 221550
2014-11-07 21:44:18 +00:00
..
BlockGenerators.cpp BlockGenerator: Recompute values from SCEV before handing back the original values 2014-11-05 20:48:56 +00:00
Cloog.cpp Remove unnecessary struct in return type 2014-05-07 11:23:35 +00:00
CodeGeneration.cpp Use braces in multi-statement DEBUG() code [NFC] 2014-10-22 23:00:03 +00:00
IRBuilder.cpp Safely generate new loop metadata node 2014-11-07 21:44:18 +00:00
IslAst.cpp Fix formatting 2014-11-06 21:25:54 +00:00
IslCodeGeneration.cpp Extract SCEV generation into subfunction 2014-11-06 00:27:01 +00:00
IslExprBuilder.cpp [Fix] Non i1 typed select condition for weird pw aff functions. 2014-10-07 14:37:59 +00:00
LoopGenerators.cpp [Fix] Accidently changed the type of a libgomp argument in r219003. 2014-10-03 20:40:24 +00:00
PTXGenerator.cpp Remove use of llvm.codegen intrinsic for GPGPU codegen 2014-06-24 08:11:36 +00:00
RuntimeDebugBuilder.cpp Use argument type directly from fflush if available in translation unit 2014-11-04 09:18:24 +00:00
Utils.cpp [Refactor] Cleanup isl code generation 2014-09-10 14:50:23 +00:00