This is an archive of the discontinued LLVM Phabricator instance.

[TableGen][GlobalISel] add handling of nested *_SUBREG
ClosedPublic

Authored by ehjogab on Sep 29 2020, 6:58 AM.

Details

Summary

When nesting INSERT_SUBREG and EXTRACT_SUBREG, GlobalISelEmitter would
fail to find the register class of the nested node. This patch fixes
that for registers with subregs.

Diff Detail

Event Timeline

ehjogab created this revision.Sep 29 2020, 6:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 29 2020, 6:58 AM
Herald added a subscriber: rovka. · View Herald Transcript
ehjogab requested review of this revision.Sep 29 2020, 6:58 AM
arsenm added inline comments.Sep 29 2020, 7:23 AM
llvm/test/TableGen/GlobalISelEmitter-nested-subregs.td
33

This is missing the checks?

llvm/utils/TableGen/GlobalISelEmitter.cpp
4954

No else after return

4960

No else after return

ehjogab updated this revision to Diff 294989.Sep 29 2020, 7:47 AM
  • add missing check in testcase
  • fix lint warnings
ehjogab marked an inline comment as done.Sep 29 2020, 7:49 AM

Oops, had missed that. Thanks!

ehjogab added inline comments.Sep 29 2020, 7:50 AM
llvm/utils/TableGen/GlobalISelEmitter.cpp
4954

In the original code, there is only an 'if' and no 'else', so I followed the same original structure by just adding the 'else if's. I believe the 'else' case is handled by the code that follow these if statements.

4960

Same as above.

arsenm added inline comments.Sep 29 2020, 11:11 AM
llvm/utils/TableGen/GlobalISelEmitter.cpp
4954

I don't see what you are saying. There was no else after return pattern here before, and I don't see how this is continuing it. The elses can be removed and this will be a sequence of if () { foo(); return }

ehjogab added inline comments.Sep 29 2020, 11:52 PM
llvm/utils/TableGen/GlobalISelEmitter.cpp
4954

Okay, I see what you're saying now. I'll fix it right away.

ehjogab updated this revision to Diff 295183.Sep 30 2020, 12:01 AM

Removed else after return

arsenm accepted this revision.Sep 30 2020, 7:20 AM
This revision is now accepted and ready to land.Sep 30 2020, 7:20 AM
This revision was automatically updated to reflect the committed changes.
uabelho added a subscriber: uabelho.Oct 5 2020, 1:53 AM

I submitted for ehjogab.