[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 28 16:03:53 PDT 2025


================
@@ -65,6 +65,10 @@ struct CIROpAsmDialectInterface : public OpAsmDialectInterface {
       os << (boolAttr.getValue() ? "true" : "false");
       return AliasResult::FinalAlias;
     }
+    if (auto bitfield = mlir::dyn_cast<cir::BitfieldInfoAttr>(attr)) {
----------------
Andres-Salamanca wrote:

I was trying to add an IR test for, but I ran into the following parse error when trying to define a struct:

```
erro.cir:11:21: error: complete records are not yet supported
!rec_D = !cir.record<struct "D" {!u16i, !s32i}>
                    ^
```
[https://github.com/llvm/llvm-project/blob/aa8afadd251cf972bace35a674428383089c2697/clang/lib/CIR/Dialect/IR/CIRTypes.cpp#L162](https://github.com/llvm/llvm-project/blob/aa8afadd251cf972bace35a674428383089c2697/clang/lib/CIR/Dialect/IR/CIRTypes.cpp#L162)

Without the struct definition, I can't meaningfully call `get_member` or `get_bitfield`, and the resulting module ends up being empty. That makes it impossible to use `CHECK` directives to verify anything.

Should I consider it sufficient to check that the input runs without errors for now?

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


More information about the cfe-commits mailing list