[Assignment Tracking] Fix fragments for assignments to variables smaller than the...
authorOCHyams <orlando.hyams@sony.com>
Sun, 9 Apr 2023 08:47:09 +0000 (09:47 +0100)
committerOCHyams <orlando.hyams@sony.com>
Sun, 9 Apr 2023 08:58:53 +0000 (09:58 +0100)
commite932d2e62610f57b551016d24932d856956d4818
tree5e8ca98856da6d01a32d01b13850c18f2e078a58
parent9f5951f11a0ef3227077d5a47b62e8842655fbd8
[Assignment Tracking] Fix fragments for assignments to variables smaller than the alloca

Prior to this patch the trackAssignments function would attribute all stores to
an alloca to all variables linked to the alloca. This is wrong in the case
where the alloca contains variables which are smaller than the alloca, and
caused erroneous fragment information to be generated.

Now stores outside the variable bounds are discarded, and we check whether a
fragment is needed based on whether the store covers the entire variable as
opposed to whether it covers the entire alloca (except for variables of unknown
size).

Note that trackAssignments doesn't yet understand whole variables sitting at
anything other than offset 0 in an alloca - those variables are still tracked
using dbg.declares.

Fixes https://lab.llvm.org/buildbot/#/builders/70/builds/36007

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D147777
llvm/lib/IR/DebugInfo.cpp
llvm/test/DebugInfo/Generic/assignment-tracking/inline/shared-alloca.ll [new file with mode: 0644]