[PATCH] D44312: Retain both sets of debug intrinsics in HoistThenElseCodeToIf (fixes PR 36410)

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 09:56:07 PST 2018


uweigand created this revision.
uweigand added reviewers: aprantl, dblaikie, vsk, danielcdh.
Herald added subscribers: llvm-commits, eraman.

PR 36410 describes a problem where as a result of hoisting common code from "then" and "else" branches of a condition to before the "if", we get a llvm.dbg.value intrinsic with an invalid location. For those intrinsics, the scope indicated in the !dbg location must be identical with the scope of the variable tracked by the intrinsics, or else the module verifier will abort. This constraint can be violated by the current algorithm of getMergedLocation.

Following discussion in https://reviews.llvm.org/D43687, this patch attempts to implement a different approach to fixing this problem.  Instead of attempting to merge the locations of two debug intrinsics, we now simply always keep all debug intrinsics from both sides of the "if" during HoistThenElseCodeToIf.  This has the additional benefit that we no longer throw away still valid information to help generate better debug data.


Repository:
  rL LLVM

https://reviews.llvm.org/D44312

Files:
  lib/Transforms/Utils/SimplifyCFG.cpp
  test/Transforms/SimplifyCFG/hoist-dbgvalue-inlined.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44312.137777.patch
Type: text/x-patch
Size: 4540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180309/5e5baa85/attachment.bin>


More information about the llvm-commits mailing list