[RISCV] Teach computeKnownBits that vsetvli returns number less than 2^31.
authorCraig Topper <craig.topper@sifive.com>
Thu, 29 Apr 2021 15:00:10 +0000 (08:00 -0700)
committerCraig Topper <craig.topper@sifive.com>
Thu, 29 Apr 2021 15:07:59 +0000 (08:07 -0700)
commit25391cec3a81c3c2c4ac3f2ce0efda961766ab07
tree904636bd9d659ebd7274b17529f3c7875c43b1ce
parent51d648c119d7773ce6fb809353bd6bd14bca8818
[RISCV] Teach computeKnownBits that vsetvli returns number less than 2^31.

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.

Reviewed By: frasercrmck, rogfer01, arcbbb

Differential Revision: https://reviews.llvm.org/D101472
llvm/lib/Analysis/ValueTracking.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/vsetvl-ext.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/RISCV/lit.local.cfg [new file with mode: 0644]
llvm/test/Transforms/InstCombine/RISCV/riscv-vsetvli-knownbits.ll [new file with mode: 0644]