This makes DILocation::getMergedLocation() do what its comment says it
does when merging locations for an Instruction: set the common inlineAt
scope. This simplifies Instruction::applyMergedLocation() a bit.
Testing: check-llvm, check-clang
Differential D39628
[DebugInfo] Unify logic to merge DILocations. NFC. vsk on Nov 3 2017, 7:24 PM. Authored by
Details This makes DILocation::getMergedLocation() do what its comment says it Testing: check-llvm, check-clang
Diff Detail
Event TimelineComment Actions It looks like this will cause DILocation::getMergedLocation() to create new DILocations? When this happens at the MIR level this will cause problems with the textual MIR output because the new locations aren't printed. Should we introduce a flag to disable creation of new metadata? Comment Actions getMergedLocation() shouldn't be able to create a new DILocation unless ForInst is-a CallInst, which shouldn't happen at the MIR level. If we added a flag to explicitly disable creation of new metadata, it would be 'true' iff ForInst is not a CallInst. Can I instead add more documentation for the ForInst parameter? Comment Actions Prior to this patch, the common-parent-scope finding logic could only kick in if this is-a CallInst. That behavior is preserved: DILocation::getMergedLocation() only finds a common parent scope when ForInst is-a CallInst. Comment Actions Oh.. I overlooked the early exit. Yeah I guess we can do this.
definitely. Comment Actions I've run into an internal compiler error that seems caused by this behavior of getMergedLocation: https://bugs.llvm.org/show_bug.cgi?id=36410 |