This patch (5/N) stems from D69787 as suggested by reviewers.
The original patch is being divided as described below.
CodeGen / DwarfInfo-emission phase of the implementation works on IR with DW_OP_implicit_pointer operation to emit debug info. this will have two patch (PATCH 1-2). PATCH-1 has changes for IR Verify and Bitcode changes. The current patch (PATCH-2) will complete the modification for Codegen. It also contains test cases with IR generated with future patches.
IR transformation phase of the implementation deals with preserving debug info while instruction is being erased (optimized out) in IR transformation phase. In this phase all the opportunities to generate DW_OP_implicit_pointer operation in IR, are found and handled appropriately. For this phase multiple patches will be submitted.
PATCH 3) Enhance salvaging implementation to generate DW_OP_implicit_pointer operation PATCH 4-N) All the opportunities to preserve debug info are dealt with (to support various optimizations)
Current PATCH is PATCH-2. Once this gets accepted, PATCH-3 will be submitted.
After PATCH-3 gets accepted, PATCH 4-N can be submitted independently.
Summary: This patch completes the back-end support for DW_OP_implicit_pointer operation. When it receives IR with DW_OP_LLVM_implicit_pointer operator, it processes that to generate proper debug-info. It generates location lists having DW_OP_implicit_pointer operations. Testing: - Added unit tests (with IR generated from future patches) for validation thru llvm-dwarfdump - check-llvm, and an end-to-end test using gnu GDB to debug an optimized program (LLDB need to be enhanced to support). - check-debuginfo (the debug info integration tests)
I don't believe running clang in an internal LLVM test is supported, this should probably be running llc -O2 -filetype=obj instead? Same with the other tests.