This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly][NFC] Add ComplexPattern for loads
ClosedPublic

Authored by luke on Dec 8 2022, 7:36 AM.

Details

Summary

This refactors out the offset and address operand pattern matching into a ComplexPattern, so that one pattern fragment can match the dynamic and static (offset) addresses in all possible positions.

Split out from D139530, which also contained an improvement to global address folding.

Diff Detail

Event Timeline

luke created this revision.Dec 8 2022, 7:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2022, 7:36 AM
luke requested review of this revision.Dec 8 2022, 7:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2022, 7:36 AM
tlively accepted this revision.Dec 9 2022, 7:59 AM

LGTM. It definitely makes the tablegen simpler, and I think the C++ isn't that complicated.

This revision is now accepted and ready to land.Dec 9 2022, 7:59 AM

Mostly naming and formatting nits. By the way, are you planning to work on store patterns too? If so that'd be more consistent with this.

llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
296–298

Can we wrap comments to 80 cols if possible? The same for other comment blocks too.

317

We don't seem to abbreviate Type as Typ in this file or other files in Wasm backend, so for consistency I suggest we just say Type.

llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
96

How about using addr in place of dynamic for consistency within this file? For other occurrences in the patterns and comments too.

96–99

I guess this doesn't affect the functionality, but we use this for offsets in other patterns too, so for consistency.

102–104
luke updated this revision to Diff 482500.Dec 13 2022, 8:38 AM

Adjust naming and formatting (Whoops, not sure why fill-column defaults to 70 in emacs)

luke marked 5 inline comments as done.Dec 13 2022, 8:39 AM

Thanks for picking those up, should be addressed now.

By the way, are you planning to work on store patterns too? If so that'd be more consistent with this.

That would be great to get done as well. I'll give it a stab in another patch.

luke updated this revision to Diff 482502.Dec 13 2022, 8:42 AM

Format commit message

luke updated this revision to Diff 482506.Dec 13 2022, 8:52 AM

Fix typo

aheejin accepted this revision.Dec 13 2022, 3:11 PM

Thank you! I agree this is more readable and easier to manage.

llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
317–318

clang-format

Please clang-format patches before submitting. You can subscribe to https://reviews.llvm.org/project/view/78/ which lets you know when clang-format errors are found. One downside of that hook is, it seems to some build testing, which always seem to fail, which we don't need to care...

aheejin added inline comments.Dec 13 2022, 4:18 PM
llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
83–85

Nit: 80col wrapping

luke updated this revision to Diff 482779.Dec 14 2022, 3:11 AM

Fix formatting

luke marked 2 inline comments as done.Dec 14 2022, 3:12 AM
This revision was landed with ongoing or failed builds.Dec 14 2022, 4:12 AM
This revision was automatically updated to reflect the committed changes.