[PATCH] D29833: Improve the API of DILocation::getMergedLocation()

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 16:21:10 PST 2017


aprantl added a comment.

[apologies for iterating so slowly at the moment]

In https://reviews.llvm.org/D29833#682595, @twoh wrote:

> Personally I prefer the existing API, because it doesn't allow the transient state before merging. For example, in lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp in this patch, DebugLoc of NewSI is not actually valid after line 1430. Existing API doesn't have this problem.


If that is the only concern, would an additional convenience function solve (= sufficiently hide) the problem?

  Instruction::setMergedDebugLoc(DebugLoc A, DebugLoc B) {
    setDebugLoc(A);
    mergeDebugLocWith(B);
  }

The primary benefit of having the API on Instruction is that we can make it impossible to accidentally create a locationless call instruction in a function with debuginfo (which would crash/assert the backend when creating inline scopes).


Repository:
  rL LLVM

https://reviews.llvm.org/D29833





More information about the llvm-commits mailing list