[all-commits] [llvm/llvm-project] 3255d4: [Bitcode] Decode small byte constants as signed va...

Drew Kersnar via All-commits all-commits at lists.llvm.org
Fri Jun 12 07:35:54 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3255d4d7628719c4b6254db5780ec50862584896
      https://github.com/llvm/llvm-project/commit/3255d4d7628719c4b6254db5780ec50862584896
  Author: Drew Kersnar <dkersnar at nvidia.com>
  Date:   2026-06-12 (Fri, 12 Jun 2026)

  Changed paths:
    M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
    A llvm/test/Bitcode/byte-constants.ll

  Log Message:
  -----------
  [Bitcode] Decode small byte constants as signed values (#203408)

Decode small byte constants the same way we encode them. The bitcode
writer stores ConstantByte values as signed integers, so the reader must
rebuild them using the signed ConstantByte::get path. This has high-bit
values like b8 255 round-trip as their canonical signed form, b8 -1,
instead of tripping the APInt width assertion. This matches current i8
behavior.

Before the fix, the new test crashes in llvm-dis with: "APInt.h:
Assertion `llvm::isUIntN(BitWidth, val) && "Value is not an N-bit
unsigned value"' failed."

Bug found while investigating this PR
(https://github.com/llvm/llvm-project/pull/177908), which transitions
the LSV to emitting the byte type. Fix assisted by AI.



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