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

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 09:09:35 PST 2017


> On Feb 22, 2017, at 4:34 PM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> If an instruction is hoisted across a BB without adjusting the location, a sample based profile taken at that location would incorrectly count a hit to the source BB even though it may not be executed. (eg: CSE moves similar code from an 'if' and 'else' block to before the predecessor (or sinks it to a successor) and picks the 'if' block's instructions as the ones to move (deleting the 'else' block) - now every time the profile observes the evaluation of the common subexpression it counts it as the 'if' block executing - when it's possible the 'if' block never executes and only the 'else' block is ever chosen)

That part makes sense to me, my question was more how this would affect our choice between:

  Instruction::mergeLocationWith(DebugLoc Other);
  Instruction::setMergedLocation(DebugLoc A, DebugLoc B);

and

  static DebugLoc::getMergedLocation(DebugLoc A, DebugLocB);

?

-- adrian


More information about the llvm-commits mailing list