llvm
86e23d23 - [CIR] Load enums with a boolean underlying type (#205880)

Commit
20 hours ago
[CIR] Load enums with a boolean underlying type (#205880) emitLoadOfScalar reported NYI for any scalar whose type has a boolean representation but isn't the builtin bool, so loading an enum with a fixed bool underlying type (e.g. enum E : bool) failed to compile. The errorNYI also left the function's entry block without a terminator, so the translation unit then failed CIR module verification. Such an enum converts to !cir.bool (via convertType of its underlying type), and convertTypeForMem does not widen it, so the cir.load result is already the literal CIR type CIR uses for that enum everywhere. CIR keeps bool in !cir.bool through CIRGen and defers the in-memory i8 widening to LowerToLLVM (see the emitToMemory comment), so no register/memory conversion is needed at this point. The fix drops the errorNYI and returns the loaded value, matching the plain-bool path directly above it. The same guard also covered _BitInt(1), which converts to !cir.int<1> and follows the identical deferral; it now loads too. This does not change the in-memory representation of either type, which LowerToLLVM still owns. The test covers load and store of an enum : bool across CIR, the CIR-lowered LLVM, and classic CodeGen.
Author
Parents
Loading