[PATCH] D29927: [DebugInfo] Make DILocation::getMergedLocation to return a dummy location instead of nullptr

Taewook Oh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 00:08:27 PST 2017


twoh created this revision.

Currently, DILocation::getMergedLocation returns nullptr if LocA and LocB come from different locations so that they can be discriminated. However, dropping metadata by returning nullptr may cause a problem when handling inlinable callsites, as discussed in PR31891. Since inlinable calls are required to have a scope information, if two inlinable calls are hoisted and merged, and the merged instruction does not have a debug location info because debug locations of original instructions are different, module verifier fails. For this reason r294250 has been reverted.

This patch makes getMergedLocation returning nullptr only when either LocA or LocB is a nullptr. Otherwise, if LocA and LocB can be discriminated, the function returns a dummy location of (line: 0, column: 0). It asserts that LocA and LocB are in the same scope considering inlining context, and use that scope for the dummy location info to return. This assertion might be unnecessary considering that the return value is a dummy location anyway, but I think performing the merge between two DILocation in different scope should not be permitted.


https://reviews.llvm.org/D29927

Files:
  include/llvm/IR/DebugInfoMetadata.h
  test/DebugInfo/Generic/instcombine-phi.ll
  test/DebugInfo/Generic/simplifycfg_sink_last_inst.ll
  test/DebugInfo/Generic/store-tail-merge.ll
  test/Transforms/SimplifyCFG/remove-debug-2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29927.88320.patch
Type: text/x-patch
Size: 8551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170214/391fb728/attachment.bin>


More information about the llvm-commits mailing list