[all-commits] [llvm/llvm-project] ee25d3: [SPIRV] Preserve sign-sensitive width record acros...

Faijul Amin via All-commits all-commits at lists.llvm.org
Tue Jul 28 11:02:32 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ee25d3ec23a8b612ae3fa3eed8f8b88b00f582df
      https://github.com/llvm/llvm-project/commit/ee25d3ec23a8b612ae3fa3eed8f8b88b00f582df
  Author: Faijul Amin <md.faijul.amin at intel.com>
  Date:   2026-07-28 (Tue, 28 Jul 2026)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp
    M llvm/test/CodeGen/SPIRV/legalization/signed-narrow-int.ll

  Log Message:
  -----------
  [SPIRV] Preserve sign-sensitive width record across G_TRUNC replacement (#211626)

**Summary**
Follow-up to #203661. When the `G_TRUNC` handler in `SPIRVPreLegalizer`
collapses source and destination to the same widened width, it calls
`MRI.replaceRegWith(DstReg, MaskedReg)` and drops the original
`G_TRUNC`. The `SignSensitiveInfo.OrigWidth` map, however, was still
keyed on `DstReg`, so `widenSignSensitiveOps` no longer found the narrow
original width and skipped the `shl/ashr` sign extension for signed
users of the truncated value.
Rekey `OrigWidth` from `DstReg` to `MaskedReg` before the
`replaceRegWith` so signed ops fed by the truncated value still receive
`G_SEXT_INREG` on the widened type.

**Test plan**
New test case is added to
`llvm/test/CodeGen/SPIRV/legalization/signed-narrow-int.ll`: `trunc i8 →
i4` feeding `icmp slt` — src and dst both widen to `i8`, exercising the
same-width `replaceRegWith` path. Checks that the widened `i8` compare
is preceded by matching `OpShiftLeftLogical / OpShiftRightArithmetic`
pairs on both operands.



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