This is an archive of the discontinued LLVM Phabricator instance.

RegisterCoalescer: Don't delete IMPLICIT_DEF if it's live into the same block
ClosedPublic

Authored by arsenm on Aug 25 2023, 1:02 PM.

Details

Summary

Live out implicit_defs need to be kept, but the check for this only
checked if the block parent was the same. This doesn't work if the
parent blocks are the same but the value is live. Fixes verifier error
"Instruction ending live segment doesn't read the register", which
would appear at the coalesced non-implicit_def def.

Fixes #38788

Diff Detail

Event Timeline

arsenm created this revision.Aug 25 2023, 1:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 1:02 PM
arsenm requested review of this revision.Aug 25 2023, 1:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 1:02 PM
Herald added a subscriber: wdng. · View Herald Transcript

I've done quite some testing on our downstream target with this and
https://reviews.llvm.org/D158850
without problems so it's probably not totally wrong :)

I'll leave for someone who knows the code to accept it.

llvm/test/CodeGen/X86/pr38795-verifier-error-pr38788.ll
1

I don't know what file this is? It doesn't exist in the repo and it's not added in
https://reviews.llvm.org/D158850

Something you only have in your local repo?

arsenm added inline comments.Sep 8 2023, 5:55 AM
llvm/test/CodeGen/X86/pr38795-verifier-error-pr38788.ll
1

I just moved this to the main test file

bjope added inline comments.Sep 8 2023, 9:30 AM
llvm/test/CodeGen/X86/pr38795-verifier-error-pr38788.ll
1

The file doesn't exist on main. So when trying to apply this patch it fails since there is no file with this name to delete. So there is something weird with "Diff 1" in the differential.

llvm/test/CodeGen/X86/pr38795.ll
2–3

I guess we want to do this now. I.e. enable verify-machineinstrs.

(PR39440 == GH issue 38788)

arsenm updated this revision to Diff 556361.Sep 10 2023, 1:19 AM

squash test

qcolombet accepted this revision.Sep 11 2023, 2:48 AM
This revision is now accepted and ready to land.Sep 11 2023, 2:48 AM
bjope added a comment.Sep 11 2023, 5:48 AM

I'm confused. In "Diff 2" (that now is approved) the things you did in "Diff 1" was removed,
The "diff against base" now seem to show the diff compared to the base of D158850. Which is a not-yet-approved patch prio to this in the patch stack.

So something seems really weird to me. Should this patch perhaps be rebased on top of D158850? And what about the original code changes that were in here before the "squash test" update?

(I still expect that this patch would change the RUN line in llvm/test/CodeGen/X86/pr38795.ll to enable -verify-machineinstrs as part of solving PR39440 == GH issue 38788. Right?)

arsenm updated this revision to Diff 556458.Sep 11 2023, 10:43 AM

Correct diff

bjope added inline comments.Sep 11 2023, 1:11 PM
llvm/test/CodeGen/X86/pr38795.ll
2–3

Still think you want to remove the FIXME and enabe the verifier, right?
(LGTM otherwise.)

arsenm marked an inline comment as done.Sep 11 2023, 1:57 PM
arsenm added inline comments.Sep 11 2023, 11:09 PM
llvm/test/CodeGen/X86/pr38795.ll
2–3

Only in the next patch, the first one doesn't fix it