This is an archive of the discontinued LLVM Phabricator instance.

[CGP] Reset the debug location when promoting trunc(s)
ClosedPublic

Authored by davide on Jun 15 2020, 2:07 PM.

Diff Detail

Event Timeline

davide created this revision.Jun 15 2020, 2:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2020, 2:07 PM
Herald added a subscriber: hiraditya. · View Herald Transcript

This is the same issue of D81437, when hoisting/promoting the trunc we don't want to assign it a location that could cause a jump in the line table.

davide updated this revision to Diff 270861.Jun 15 2020, 2:14 PM

Context + simplified testcase.

vsk accepted this revision.Jun 15 2020, 2:18 PM

Thanks, lgtm. I had a look at the other TypePromotionActions in CodeGenPrepare: I think it'd be better to default to these /not/ carrying over debug locations, even though in some cases it would be appropriate to do so (e.g. if the instruction reordering is block-local), just because there's so much cross-BB movement.

This revision is now accepted and ready to land.Jun 15 2020, 2:18 PM

Yes, I agree. I'm going to craft test cases for these too.

davide closed this revision.Jun 15 2020, 2:25 PM

Committed in:

commit c2dccf9d5e34278cb2ed0a018405848850508b99 (HEAD -> master, origin/master, origin/HEAD)
Author: Davide Italiano <ditaliano@apple.com>
Date:   Mon Jun 15 14:25:30 2020 -0700

    [CodeGenPrepare] Reset the debug location when promoting trunc(s)
    
    The promotion machinery in CGP moves instructions retaining
    debug locations. When the transformation is local, this is mostly
    correct, but when instructions are moved cross-BBs, this is not
    always true and causes jumpiness in line tables. This is the first
    of a series of commits. sext(s) and zext(s) need to be treated
    similarly.
    
    Differential Revision:  https://reviews.llvm.org/D81879