This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add macrofusion infrastructure and one example usage.
ClosedPublic

Authored by craig.topper on Jun 22 2022, 3:41 PM.

Details

Summary

This adds the macrofusion plumbing and support fusing LUI+ADDI(W).

This is similar to D73643, but handles a different case. Other cases
can be added in the future.

Diff Detail

Event Timeline

craig.topper created this revision.Jun 22 2022, 3:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2022, 3:41 PM
craig.topper requested review of this revision.Jun 22 2022, 3:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2022, 3:41 PM
reames accepted this revision.Jun 22 2022, 6:17 PM

LGTM w/one required change.

llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
147

I think you want this to be returned only if macro enabled. Or at least, unconditionally enabling a machine scheduler seems like it should be a separate change.

This revision is now accepted and ready to land.Jun 22 2022, 6:17 PM
craig.topper added inline comments.Jun 22 2022, 9:02 PM
llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
147

I don't think this changed anything. If this function returns nullptr, the caller ends up calling createGenericSchedLive anyway. But I'll change it.

Address review comment

clang-format

asb added a comment.Jun 23 2022, 2:56 AM

LGTM, thanks Craig!

llvm/lib/Target/RISCV/RISCVMacroFusion.cpp
31

Nit: comment should end with full stop.

reames added inline comments.Jun 23 2022, 8:10 AM
llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
147

You are correct. I'd looked only at the method being overriden, and not the eventual caller. Think I still prefer the new version, but only minorly.

This revision was landed with ongoing or failed builds.Jun 23 2022, 8:40 AM
This revision was automatically updated to reflect the committed changes.