This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Handle IntToPtr constants in dbg.value
ClosedPublic

Authored by fdeazeve on Aug 1 2022, 8:31 AM.

Details

Summary

The function handleDebugValue has custom logic to handle certain kinds
constants, namely integers, floats and null pointers. However, it does
not handle constant pointers created from IntToPtr ConstantExpressions.
This patch addresses the issue by replacing the Constant with its
integer operand.

A similar bug was addressed for GlobalISel in D130642.

Diff Detail

Event Timeline

fdeazeve created this revision.Aug 1 2022, 8:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2022, 8:31 AM
fdeazeve requested review of this revision.Aug 1 2022, 8:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2022, 8:31 AM

I based the test on llvm/test/CodeGen/AArch64/fastisel-debugvalue-undef.ll, as I couldn't find a more generic test that was looking for these constants in dbg.value intrinsics.

aprantl accepted this revision.Aug 1 2022, 10:15 AM
This revision is now accepted and ready to land.Aug 1 2022, 10:15 AM
aprantl added inline comments.Aug 1 2022, 10:17 AM
llvm/test/CodeGen/AArch64/inttoptr_debug_value.ll
2

does this also work with llc -O0

fdeazeve added inline comments.Aug 1 2022, 1:06 PM
llvm/test/CodeGen/AArch64/inttoptr_debug_value.ll
2

With O0, we default to global isel, and we have fixed the bug there.
I couldn't find a way to force selection dag with O0, there doesn't seem to be any llc flags for that.

This revision was automatically updated to reflect the committed changes.