Page MenuHomePhabricator

[DebugInfo] Clear subreg in setDebugValueUndef()
ClosedPublic

Authored by dstenb on Oct 22 2020, 2:54 AM.

Details

Summary

When switching the register debug operands to $noreg in
setupDebugValueUndef() also clear the sub-register indices for virtual
registers. This is done when marking DBG_VALUEs undef in other cases,
e.g. in LiveDebugVariables. I have not found any cases where leaving the
sub-register index causes any issues, and the indices would eventually
get dropped when LiveDebugVariables reinserted the undef DBG_VALUEs
after register scheduling, but if nothing else it looked a bit weird in
printouts to have sub-register indices on $noreg, and I don't think the
sub-register index holds any meaningful information at that point.

I have not been able to find any source-level reproducer for this with
an upstream target, so I have just added an instrumented machine-sink
test.

Diff Detail

Unit TestsFailed

TimeTest
550 mslinux > AddressSanitizer-x86_64-linux.TestCases::strcmp.c
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/./bin/clang -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 /mnt/disks/ssd0/agent/llvm-project/compiler-rt/test/asan/TestCases/strcmp.c -o /mnt/disks/ssd0/agent/llvm-project/build/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/strcmp.c.tmp
380 mslinux > HWAddressSanitizer-x86_64.TestCases::sizes.cpp
Script: -- : 'RUN: at line 3'; /mnt/disks/ssd0/agent/llvm-project/build/./bin/clang --driver-mode=g++ -m64 -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -mcmodel=large -mllvm -hwasan-globals -mllvm -hwasan-use-short-granules -mllvm -hwasan-instrument-landing-pads=0 -mllvm -hwasan-instrument-personality-functions /mnt/disks/ssd0/agent/llvm-project/compiler-rt/test/hwasan/TestCases/sizes.cpp -nostdlib++ -lstdc++ -o /mnt/disks/ssd0/agent/llvm-project/build/projects/compiler-rt/test/hwasan/X86_64/TestCases/Output/sizes.cpp.tmp

Event Timeline

dstenb created this revision.Oct 22 2020, 2:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 22 2020, 2:54 AM
dstenb requested review of this revision.Oct 22 2020, 2:54 AM
djtodoro accepted this revision.Oct 22 2020, 5:16 AM

This looks reasonable to me.

(some nits included)

llvm/test/DebugInfo/MIR/X86/machinesink-subreg.mir
23

unused, it can be deleted

64

idex --> index

This revision is now accepted and ready to land.Oct 22 2020, 5:16 AM
jmorse accepted this revision.Oct 22 2020, 7:55 AM

LGTM, I agree the subregister index on any undef DBG_VALUE is meaningless.

This revision was landed with ongoing or failed builds.Oct 22 2020, 11:51 PM
This revision was automatically updated to reflect the committed changes.
dstenb marked 2 inline comments as done.