[Assignment Tracking][11/*] Update RemoveRedundantDbgInstrs
authorOCHyams <orlando.hyams@sony.com>
Wed, 16 Nov 2022 12:20:12 +0000 (12:20 +0000)
committerOCHyams <orlando.hyams@sony.com>
Wed, 16 Nov 2022 12:27:18 +0000 (12:27 +0000)
commit4898568caa9f8f1e4d10ec415b46966a8dc19bd9
tree63c416074c5e047a2c3d8a6d30c05f39b9bace2d
parentb3f94fe1c3c4f4fd7a937288b5543c4067b3e2f2
[Assignment Tracking][11/*] Update RemoveRedundantDbgInstrs

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Update the RemoveRedundantDbgInstrs utility to avoid sometimes losing
information when deleting dbg.assign intrinsics.

removeRedundantDbgInstrsUsingBackwardScan - treat dbg.assign intrinsics that
are not linked to any instruction just like dbg.values. That is, in a block of
contiguous debug intrinsics, delete all other than the last definition for a
fragment. Leave linked dbg.assign intrinsics in place.

removeRedundantDbgInstrsUsingForwardScan - Don't delete linked dbg.assign
intrinsics and don't delete the next intrinsic found even if it would otherwise
be eligible for deletion.

remomveUndefDbgAssignsFromEntryBlock - Delete undef and unlinked dbg.assign
intrinsics encountered in the entry block that come before non-undef
non-unlinked intrinsics for the same variable.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D133294
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/test/DebugInfo/Generic/assignment-tracking/remove-redundant-fwd-scan-linked.ll [new file with mode: 0644]
llvm/test/DebugInfo/Generic/assignment-tracking/remove-redundant.ll [new file with mode: 0644]