[all-commits] [llvm/llvm-project] 0926d9: [GlobalISel] Take the result size into account whe...

KRM7 via All-commits all-commits at lists.llvm.org
Mon May 5 10:02:14 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0926d94453096a37ec324a51d88ec203baedc3ea
      https://github.com/llvm/llvm-project/commit/0926d94453096a37ec324a51d88ec203baedc3ea
  Author: KRM7 <rugasikrisztian at gmail.com>
  Date:   2025-05-05 (Mon, 05 May 2025)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/Utils.h
    M llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp
    M llvm/lib/CodeGen/GlobalISel/Utils.cpp
    M llvm/unittests/CodeGen/GlobalISel/CSETest.cpp

  Log Message:
  -----------
  [GlobalISel] Take the result size into account when const folding icmp (#134365)

The current implementation always creates a 1 bit constant for the
result of the `G_ICMP`, which will cause issues if the destination
register size is larger than that. With asserts enabled, it will cause a
crash in `buildConstant`:
```
llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp:322: virtual MachineInstrBuilder llvm::MachineIRBuilder::buildConstant(const DstOp &, const ConstantInt &): Assertion `EltTy.getScalarSizeInBits() == Val.getBitWidth() && "creating constant with the wrong size"' failed. 
```



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