This is an archive of the discontinued LLVM Phabricator instance.

Add salvageDebugInfo support for ptrtoint / inttoptr with trunc/ext behavior
ClosedPublic

Authored by aprantl on Sep 24 2021, 5:12 PM.

Details

Summary

This patch enables debug info salvaging for truncating/extending ptr int conversions. The testcase uncovered a bug in adce, which is addressed separately.

Diff Detail

Event Timeline

aprantl created this revision.Sep 24 2021, 5:12 PM
aprantl requested review of this revision.Sep 24 2021, 5:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2021, 5:12 PM
myhsu added a comment.Sep 24 2021, 9:14 PM

This patch seems reasonable to me

llvm/lib/Transforms/Utils/Local.cpp
1924

(nit) Should we bail out if FromTypeBitSize and ToTypeBitSize are the same? Usually these two values are different for sext/zext/trunc but for inttoptr/ptrtoint it's pretty common that they have the same value.

aprantl added inline comments.Sep 27 2021, 10:59 AM
llvm/lib/Transforms/Utils/Local.cpp
1924

Interestingly, no! If the size is the same CI->isNoopCast(DL) will return true, even for ptrtoint/inttoptr.

myhsu added inline comments.Sep 27 2021, 2:46 PM
llvm/lib/Transforms/Utils/Local.cpp
1924

Ahh i see, good catch!

myhsu accepted this revision.Sep 27 2021, 2:47 PM
This revision is now accepted and ready to land.Sep 27 2021, 2:47 PM
This revision was landed with ongoing or failed builds.Sep 28 2021, 10:25 AM
This revision was automatically updated to reflect the committed changes.