This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][LoopStrengthReduction] Avoid crashes when translating SCEVs containing large integers
ClosedPublic

Authored by chrisjackson on Aug 4 2021, 3:17 AM.

Details

Summary

SCEV-based salvaging in LSR translates SCEVs to DIExpressions. SCEVs may
contain very large integers but the translation does not support >64-bit
integers. This patch adds checks to ensure conversions of these large
integers are not attempted.

A regression test, using the repro provided by @JosephTremoulet has also
been added to ensure no such translation is attempted.

PR: https://bugs.llvm.org/show_bug.cgi?id=51329

Diff Detail

Event Timeline

chrisjackson created this revision.Aug 4 2021, 3:17 AM
chrisjackson requested review of this revision.Aug 4 2021, 3:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2021, 3:17 AM

@JosephTremoulet if the revision goes in, are you happy for me to use your repro as the test, and would you like a credit in the commit?

The implementation looks good to me, the test looks a little funky (see inline comment).

llvm/test/Transforms/LoopStrengthReduce/pr51329.ll
27

Is there a reason the dbg.value in this test uses undef? It looks like a test that logically shouldn't trigger any salvaging behaviour, and probably a bug that needs fixing if the test does work. If this is intended behaviour in some way, it could probably do with a comment at least.

The implementation looks good to me, the test looks a little funky (see inline comment).

Yes I spotted this, and will add an additional patch to prevent the dbg.val being cached for salvaging.

Updated test so that the salvage of an undef'd dbg.value is not attempted. A patch will follow to ensure such salvages are never attempted.

chrisjackson marked an inline comment as done.Aug 4 2021, 4:52 AM

Updated test so that the salvage of an undef'd dbg.value is not attempted. A patch will follow to ensure such salvages are never attempted.

Please see D107448 for this patch,

Thanks for the quick fix!

@JosephTremoulet if the revision goes in, are you happy for me to use your repro as the test, and would you like a credit in the commit?

Yes, happy for you to use the repro for the test. No attribution necessary.

Is there a reason the dbg.value in this test uses undef?

That wasn't deliberate on my part, just what popped out from the failure in our rolling tests plus bugpoint.

StephenTozer accepted this revision.Aug 4 2021, 7:15 AM

Changes LGTM.

This revision is now accepted and ready to land.Aug 4 2021, 7:15 AM
This revision was landed with ongoing or failed builds.Aug 4 2021, 7:53 AM
This revision was automatically updated to reflect the committed changes.