================ @@ -2244,6 +2245,54 @@ mlir::LogicalResult CIRToLLVMComplexImagOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMGetBitfieldOpLowering::matchAndRewrite( + cir::GetBitfieldOp op, OpAdaptor adaptor, + mlir::ConversionPatternRewriter &rewriter) const { + + mlir::OpBuilder::InsertionGuard guard(rewriter); + rewriter.setInsertionPoint(op); + + cir::BitfieldInfoAttr info = op.getBitfieldInfo(); + uint64_t size = info.getSize(); + uint64_t offset = info.getOffset(); + mlir::Type storageType = info.getStorageType(); + mlir::MLIRContext *context = storageType.getContext(); + unsigned storageSize = 0; + + if (auto arTy = mlir::dyn_cast<cir::ArrayType>(storageType)) ---------------- Andres-Salamanca wrote:
Yes, we can still produce arrays when clipping. Here's an example: https://godbolt.org/z/sGae8vcze. The CodeGen explanation for this case is here: https://github.com/llvm/llvm-project/blob/fb24b4d46a0a8278031f42c1cba6c030eb6c6010/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp#L44C1-L49C27 Also, clipping can occur when the target does not support unaligned bitfield access, when `!astContext.getTargetInfo().hasCheapUnalignedBitFieldAccess()` is true. However, for our case, that's currently NYI. https://github.com/llvm/llvm-project/pull/145971 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits