[Mlir-commits] [mlir] [mlir][LLVMIR] Verify that `IntegerAttr` type matches result type in `llvm.mlir.constant` (PR #205304)

Anutosh Bhat llvmlistbot at llvm.org
Tue Jun 23 02:37:42 PDT 2026


anutosh491 wrote:

Should see the following now 
```
anutosh491 at Anutoshs-MacBook-Air mlir-build % cat bin/a.mlir
module {
  llvm.func @test_shl_i8_nowrap() -> i64 {
    %0 = llvm.mlir.constant(1 : i8) : i64
    %1 = llvm.shl %0, %0 : i64
    llvm.return %1 : i64
  }
}%        
                                                                                                                         
anutosh491 at Anutoshs-MacBook-Air mlir-build % ./bin/mlir-opt bin/a.mlir          
bin/a.mlir:3:10: error: 'llvm.mlir.constant' op integer attribute type 'i8' does not match op type 'i64'
    %0 = llvm.mlir.constant(1 : i8) : i64
         ^
bin/a.mlir:3:10: note: see current operation: %0 = "llvm.mlir.constant"() <{value = 1 : i8}> : () -> i64
```

https://github.com/llvm/llvm-project/pull/205304


More information about the Mlir-commits mailing list