Files
clang-p2996/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
Craig Topper 52646d087c [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.
2024-12-06 21:31:19 -08:00

32 KiB