[all-commits] [llvm/llvm-project] 09606d: [RISCV] Update the computeKnownBitsForTargetNode f...

Craig Topper via All-commits all-commits at lists.llvm.org
Mon Jan 31 09:13:44 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 09606d6a635b15ae08d596bedaa5bd88d7f8ea1a
      https://github.com/llvm/llvm-project/commit/09606d6a635b15ae08d596bedaa5bd88d7f8ea1a
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-01-31 (Mon, 31 Jan 2022)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/lib/Target/RISCV/RISCVSubtarget.h

  Log Message:
  -----------
  [RISCV] Update the computeKnownBitsForTargetNode for RISCVISD::READ_VLENB to consider Zve/Zvl.

We had previously hardcoded this to assume that vector registers
are 128 bits. This was true when only V existed, but after Zve
extensions were added this became incorrect.

This patch adjusts it to support 128, 64, or 32 bit vectors depending
on Zvl. The 128-bit limit is artificial, but we don't have any test
coverage showing that we larger values so I was being conservative.

None of our lit tests depend on this code today due to the custom
lowering of ISD::VSCALE that inserts the appropriate left or right
shift to convert from VLENB to VSCALE. That code was added after
this code in computeKnownBitsForTargetNode.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D118582


  Commit: 2e45e8abb11b007ec9f575b1ea9b20b42fa74445
      https://github.com/llvm/llvm-project/commit/2e45e8abb11b007ec9f575b1ea9b20b42fa74445
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-01-31 (Mon, 31 Jan 2022)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp

  Log Message:
  -----------
  [RISCV] Add a fatal error if ISD::VSCALE is used with Zvl32b.

We convert VLEN to vscale by dividing by RVVBitsPerBlock which is
currently 64. This is only correct if VLEN is evenly divisible by
64. With only Zvl32b we can't assume that.

This patch adds a fatal_error to prevent generating code that may
be broken.

We probably need to look at how we size stack frame objects too.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D118583


Compare: https://github.com/llvm/llvm-project/compare/23f73ff5f6fd...2e45e8abb11b


More information about the All-commits mailing list