This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Teach computeKnownBits that vsetvli returns number less than 2^31.
ClosedPublic

Authored by craig.topper on Apr 28 2021, 10:16 AM.

Details

Summary

This seems like a reasonable upper bound on VL. WG discussions for
the V spec would probably allow us to use 2^16 as an upper bound
on VLEN, but this is good enough for now.

This allows us to remove sext and zext if user happens to assign
the size_t result into an int and then uses it as a VL intrinsic
argument which is size_t.

Diff Detail

Event Timeline

craig.topper created this revision.Apr 28 2021, 10:16 AM
craig.topper requested review of this revision.Apr 28 2021, 10:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2021, 10:16 AM
Herald added a subscriber: MaskRay. · View Herald Transcript
rogfer01 accepted this revision.Apr 28 2021, 10:40 PM

LGTM. Thanks.

This revision is now accepted and ready to land.Apr 28 2021, 10:40 PM
arcbbb accepted this revision.Apr 28 2021, 11:45 PM

LGTM too.

frasercrmck accepted this revision.Apr 29 2021, 1:04 AM

LGTM otherwise, cheers!

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
5789

Should we have an explicit default? I know some compilers warn about that.