OSDN Git Service

[Mem2Reg] Create merged debug locations for inserted phis
authorVedant Kumar <vsk@apple.com>
Tue, 17 Apr 2018 22:03:08 +0000 (22:03 +0000)
committerVedant Kumar <vsk@apple.com>
Tue, 17 Apr 2018 22:03:08 +0000 (22:03 +0000)
commit7860aaa87bdd2eebfba39557cc82c3dd14eadfb1
tree0a2a1fbfa89e94e21d21edd80e0a830a9863ceb2
parent57045499a5e753bdcde866e45fb5aa9867bb8173
[Mem2Reg] Create merged debug locations for inserted phis

Track the debug locations of the incoming values to newly-created phis,
and apply merged debug locations to the phis.

A merged location will be on line 0, but will have the correct scope
set. This improves crash reporting when an inlined instruction with a
merged location triggers a machine exception. A debugger will be able to
narrow down the crash to the correct inlined scope, instead of simply
pointing to the outer scope of the caller.

Taken together with a change allows generating merged line-0 locations
for  instructions which aren't calls, this results in a 0.5% increase in
the uncompressed size of the .debug_line section of a stage2+Release
build of clang (-O3 -g).

rdar://33858697

Differential Revision: https://reviews.llvm.org/D45397

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330227 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/PromoteMemoryToRegister.cpp
test/Transforms/Mem2Reg/dbg-inline-scope-for-phi.ll [new file with mode: 0644]