[clang] [CIR] Let ConstantOp builder infer its type automatically (PR #136606)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 22 07:22:03 PDT 2025


erichkeane wrote:

> Best I can tell this breaks the CIR build:
> 
> ```
> FAILED: tools/clang/include/clang/CIR/Dialect/IR/CIROpsAttributes.h.inc /local/home/ekeane/llvm-project/build/tools/clang/include/clang/CIR/Dialect/IR/CIROpsAttributes.h.inc 
> cd /local/home/ekeane/llvm-project/build && /local/home/ekeane/llvm-project/build/NATIVE/bin/mlir-tblgen -gen-attrdef-decls -I /local/home/ekeane/llvm-project/clang/include/clang/CIR/Dialect/IR -I/local/home/ekeane/llvm-project/clang/include -I/local/home/ekeane/llvm-project/build/tools/clang/include -I/local/home/ekeane/llvm-project/build/include -I/local/home/ekeane/llvm-project/llvm/include -I/local/home/ekeane/llvm-p
> roject/llvm/../mlir/include -I/local/home/ekeane/llvm-project/build/tools/mlir/include /local/home/ekeane/llvm-project/clang/include/clang/CIR/Dialect/IR/CIROps.td --write-if-changed -o tools/clang/include/clang/CIR/Dialect/IR/CIROpsAttributes.h.inc -d tools/clang/include/clang/CIR/Dialect/IR/CIROpsAttributes.h.inc.d
> Included from /local/home/ekeane/llvm-project/clang/include/clang/CIR/Dialect/IR/CIROps.td:19:
> /local/home/ekeane/llvm-project/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td:110:5: error: Using a raw APInt parameter without a custom comparator is not supported because an assert in the equality operator is triggered when the two APInts have different bit widths. This can lead to unexpected crashes. Use an `APIntParameter` or provide a custom comparator.
> def IntAttr : CIR_Attr<"Int", "int", [TypedAttrInterface]> {
>     ^
> ```
> 
> Do you have a fix for this?
> 
> @andykaylor @mmha @bcardosolopes

Hmm.. I get this issue, but I'm not convinced any longer that THIS patch caused it.  I'm going to have to do a more aggressive bisect :)  I'll let you know how it turns out.

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


More information about the cfe-commits mailing list