[PATCH] D42551: [Debug] Add dbg.value intrinsics for PHIs created during LCSSA.

Matt Davis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 14:11:13 PST 2018


mattd updated this revision to Diff 133074.
mattd added a comment.

This is an updated patch to handle the insertion of dbg.value intrinsics on behalf of LCSSA PHI generation.  The original logic was reverted due to a dbg.value instrinsic attempting to be inserted into a catchswitch block.  According to LangRef, catchswitch are to be the only non-PHI instructions within a block:
"The catchswitch is both a terminator and a “pad” instruction, meaning that it must be both the first non-phi instruction and last instruction in the basic block. Therefore, it must be the only non-phi instruction in the block."

This patch restores the original logic, but with an added conditional that checks that the insertion point is not a catchswitch.  The new test case was produced from PR36238 which uncovered the bug.  I also hoisted the getParent and MetadataAsValue calls outside of the inner-loop, a bit of my own hand-spun licm.

The attached test case is a pass-fail situation.  It will fail if built with assertions in the same location where PR36238 was triggering the assertion, or crash llvm otherwise.


https://reviews.llvm.org/D42551

Files:
  lib/Transforms/Utils/LCSSA.cpp
  lib/Transforms/Utils/Local.cpp
  test/Transforms/LCSSA/avoid-intrinsics-in-catchswitch.ll
  test/Transforms/LCSSA/basictest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42551.133074.patch
Type: text/x-patch
Size: 12169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180206/dc8286f6/attachment.bin>


More information about the llvm-commits mailing list