[DebugInfo] getMergedLocation: Maintain the line number if they match
authorJuan Manuel MARTINEZ CAAMAÑO <juamarti@amd.com>
Tue, 25 Oct 2022 07:29:30 +0000 (07:29 +0000)
committerJuan Manuel MARTINEZ CAAMAÑO <juamarti@amd.com>
Tue, 25 Oct 2022 14:10:21 +0000 (14:10 +0000)
commit854b1bca60ebb784e507e905885f4ba664bb65af
treedc7177a45819ff099038714f1095799e07703aeb
parent191d70f2f52d9cd38e0c57f8319b466eff1ac023
[DebugInfo] getMergedLocation: Maintain the line number if they match

getMergedLocation returns a 'line 0' DILocaiton if the two locations
being merged don't perfecly match, even if they are in the same line but
a different column.

This commit adds support to keep the line number if it matches (but only
the column differs). The merged column number is the leftmost between the
two.

Reviewed By: dblaikie, orlando

Differential Revision: https://reviews.llvm.org/D135166
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/test/DebugInfo/return-same-line-merge.ll [new file with mode: 0644]
llvm/unittests/IR/MetadataTest.cpp