This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] simplify emitVSETVLIs handling of vsetvli xN, phi(), vtype case [NFC]
ClosedPublic

Authored by reames on Jun 2 2022, 9:44 AM.

Details

Summary

This is possibly somewhat subjective, but having an explicitly named flag to track the property required and code structure that more closely matches phase 1/2 of the dataflow seems much easier to read.

Diff Detail

Event Timeline

reames created this revision.Jun 2 2022, 9:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2022, 9:44 AM
reames requested review of this revision.Jun 2 2022, 9:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2022, 9:44 AM
craig.topper added inline comments.Jun 2 2022, 9:47 PM
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
1111–1112

Why is this one true? If we insert a vsetvli in the body of the above if, don't we need to not use needVSETVLIPHI in the future?

I think the simplification is good and I'd like to see something like this. Starting off with predecessor info is logical.

I'm not sure about the name PrefixTransparent though - I think that variable needs explanation (in a comment) because, personally, the name doesn't do it on its own.

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
1111–1112

I was also wondering that.

reames updated this revision to Diff 434030.Jun 3 2022, 7:54 AM

Fix bug noted by reviewers, and add requested comment.

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
1111–1112

Because that's a flat out bug in the patch. Oops!

Fixed in the new version.

reames updated this revision to Diff 436450.Jun 13 2022, 9:47 AM

Rebase, adjust a comment to be less confusing, and ping @frasercrmck

frasercrmck accepted this revision.Jun 14 2022, 2:27 AM

I was wondering if this would be better represented as Optional<VSETVLIInfo> LocalBBInfo initialized to None before traversing the block. We'd update it along with CurInfo (LocalBBInfo = CurInfo). Then we'd know that if LocalBBInfo has been set there have been block-local updates to VL/VTYPE and thus it's not safe to look through PHIs. At least I'd find that a little to grok. It's subjective, after all.

So, LGTM.

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
1079

changed?

This revision is now accepted and ready to land.Jun 14 2022, 2:27 AM
This revision was landed with ongoing or failed builds.Jun 14 2022, 8:00 AM
This revision was automatically updated to reflect the committed changes.