[all-commits] [llvm/llvm-project] 52646d: [GISel] Teach computeKnownBitsImpl to handle COPY ...

Craig Topper via All-commits all-commits at lists.llvm.org
Fri Dec 6 21:31:41 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 52646d087cdecd217436b2714f94b84c46b5720a
      https://github.com/llvm/llvm-project/commit/52646d087cdecd217436b2714f94b84c46b5720a
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2024-12-06 (Fri, 06 Dec 2024)

  Changed paths:
    M llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
    A llvm/test/CodeGen/RISCV/GlobalISel/knownbits-copy-crash.mir

  Log Message:
  -----------
  [GISel] Teach computeKnownBitsImpl to handle COPY instructions that change bit width. (#118924)

The sexti32 ComplexRenderFn on RISCV calls computeNumSignBits which
calls computeKnownBits.

I encountered a case where we looked through a G_PHI and found a COPY
that was created from an already selected G_TRUNC from s64 to s32. s32
and s64 integers on RISC-V end up in the same register class. s32 G_PHI
is legal to allow f32 phis on RV64. The COPY inherited the types from the
original G_TRUNC so the source and destination virtual registers have
different widths.

This patch uses KnownBits::anyextOrTrunc to adjust the width when they
mismatch.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list