This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Select vl op to X0 when it is equal to ~0.
ClosedPublic

Authored by jacquesguan on Jan 7 2022, 1:09 AM.

Details

Summary

Now the backend will select ~0 vl to a register and load instruction, we could use X0 to replace it.

Diff Detail

Event Timeline

jacquesguan created this revision.Jan 7 2022, 1:09 AM
jacquesguan requested review of this revision.Jan 7 2022, 1:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 7 2022, 1:09 AM
craig.topper added inline comments.Jan 7 2022, 9:44 AM
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
1797

I don't think this works on RV32. getZExtValue would return 0xffffffff but VLMaxSentinel is 0xffffffffffffffff. I might be wrong. Please check.

craig.topper added inline comments.Jan 7 2022, 12:38 PM
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
1797

I think getSExtValue would work if I'm correct that the issue exists.

Address comment.

jacquesguan added inline comments.Jan 9 2022, 7:45 PM
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
1797

Thanks, you are right, I changed to getSExtValue.

Format code.

This revision is now accepted and ready to land.Jan 10 2022, 10:29 AM
This revision was automatically updated to reflect the committed changes.