[clang] [CIR] Add lowering for bool attributes (PR #187590)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 19 15:06:00 PDT 2026


================
@@ -511,6 +512,16 @@ mlir::LogicalResult CIRToLLVMLLVMIntrinsicCallOpLowering::matchAndRewrite(
   return mlir::success();
 }
 
+/// BoolAttr visitor.
+mlir::Value CIRAttrToValue::visitCirAttr(cir::BoolAttr boolAttr) {
+  mlir::Location loc = parentOp->getLoc();
+  mlir::DataLayout layout(parentOp->getParentOfType<mlir::ModuleOp>());
+  mlir::Value boolVal = mlir::LLVM::ConstantOp::create(
+      rewriter, loc, converter->convertType(boolAttr.getType()),
+      boolAttr.getValue());
+  return emitToMemory(rewriter, layout, boolAttr.getType(), boolVal);
----------------
erichkeane wrote:

Curious why this needs an `emitToMemory` but `IntAttr` just below doesn't?

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


More information about the cfe-commits mailing list