[LICM] Try to merge debug locations when sinking.
authorDavide Italiano <ditaliano@apple.com>
Wed, 15 Apr 2020 19:28:34 +0000 (12:28 -0700)
committerDavide Italiano <ditaliano@apple.com>
Wed, 15 Apr 2020 19:29:34 +0000 (12:29 -0700)
commit5f87415efc1e57587272944a5f9b6745e4474660
treeb04bf6c1d9fb145aa90adb8ae90d821c3f28722d
parentb2dff0dbeabc5bf0582d22d419c8a91d14359d89
[LICM] Try to merge debug locations when sinking.

The current strategy LICM uses when sinking for debuginfo is
that of picking the debug location of one of the uses.
This causes stepping to be wrong sometimes, see, e.g. PR45523.

This patch introduces a generalization of getMergedLocation(),
that operates on a vector of locations instead of two, and try
to merge all them together, and use the new API in LICM.

<rdar://problem/61750950>
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/lib/Transforms/Scalar/LICM.cpp
llvm/test/Transforms/LICM/sink-debuginfo-preserve.ll [new file with mode: 0644]