[llvm] d0f8047 - [RISCV] Teach computeKnownBitsForTargetNode that VLENB will never be more than 65536/8.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 17 11:37:59 PDT 2021
Author: Craig Topper
Date: 2021-07-17T11:24:20-07:00
New Revision: d0f8047d37bf0543a4ef758213af9aec6143df41
URL: https://github.com/llvm/llvm-project/commit/d0f8047d37bf0543a4ef758213af9aec6143df41
DIFF: https://github.com/llvm/llvm-project/commit/d0f8047d37bf0543a4ef758213af9aec6143df41.diff
LOG: [RISCV] Teach computeKnownBitsForTargetNode that VLENB will never be more than 65536/8.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/rvv-vscale.i64.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 05a1dbedeba8..e7ea2e16dcfe 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -6452,6 +6452,8 @@ void RISCVTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
case RISCVISD::READ_VLENB:
// We assume VLENB is at least 16 bytes.
Known.Zero.setLowBits(4);
+ // We assume VLENB is no more than 65536 / 8 bytes.
+ Known.Zero.setBitsFrom(14);
break;
case ISD::INTRINSIC_W_CHAIN: {
unsigned IntNo = Op.getConstantOperandVal(1);
diff --git a/llvm/test/CodeGen/RISCV/rvv/rvv-vscale.i64.ll b/llvm/test/CodeGen/RISCV/rvv/rvv-vscale.i64.ll
index 29498ad5fcfe..615822235823 100644
--- a/llvm/test/CodeGen/RISCV/rvv/rvv-vscale.i64.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/rvv-vscale.i64.ll
@@ -50,9 +50,9 @@ define i64 @vscale_uimmpow2xlen() nounwind {
;
; RV32-LABEL: vscale_uimmpow2xlen:
; RV32: # %bb.0: # %entry
-; RV32-NEXT: csrr a1, vlenb
-; RV32-NEXT: slli a0, a1, 3
-; RV32-NEXT: srli a1, a1, 29
+; RV32-NEXT: csrr a0, vlenb
+; RV32-NEXT: slli a0, a0, 3
+; RV32-NEXT: mv a1, zero
; RV32-NEXT: ret
entry:
%0 = call i64 @llvm.vscale.i64()
More information about the llvm-commits
mailing list