[clang] [CIR][NFC] Restore LoadOp builders and LowerToLLVM fix lost in #222481 (PR #223896)
Aman Maurya via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 15 19:02:01 PDT 2026
https://github.com/amanmaurya92 updated https://github.com/llvm/llvm-project/pull/223896
>From 3cb6ed48e88d051007f53768567018c3ce5d8944 Mon Sep 17 00:00:00 2001
From: amanmaurya92 <amanmaurya9209 at gmail.com>
Date: Wed, 16 Sep 2026 07:14:18 +0530
Subject: [PATCH] [CIR][NFC] Restore LoadOp builders, LowerToLLVM, and
CIRGenBuiltin fixes lost in #222481
Commit 35c6acb89abf (#222481) accidentally reverted parts of cc5e9d63b4dc (#222822) in CIROps.td, LowerToLLVM.cpp, and CIRGenBuiltin.cpp. This restores those lost changes to fix deprecation and template instantiation errors on Linux CI.
Diagnosed by Antigravity, formatted with Gemini
---
clang/include/clang/CIR/Dialect/IR/CIROps.td | 15 +++++++++++++++
clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp | 3 +--
.../lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp | 4 +++-
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 64de9ecccb58c..c5a836a0c2f03 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -844,6 +844,21 @@ def CIR_LoadOp : CIR_Op<"load", [
$addr `:` qualified(type($addr)) `,` type($result) attr-dict
}];
+ let builders = [
+ OpBuilder<(ins "mlir::Value":$addr), [{
+ build($_builder, $_state, addr, /*isDeref=*/false,
+ /*is_volatile=*/false, /*is_nontemporal=*/false,
+ /*alignment=*/mlir::IntegerAttr{}, cir::SyncScopeKindAttr{},
+ cir::MemOrderAttr{}, /*invariant=*/false);
+ }]>,
+ OpBuilder<(ins "mlir::Type":$result, "mlir::Value":$addr), [{
+ build($_builder, $_state, result, addr, /*isDeref=*/false,
+ /*is_volatile=*/false, /*is_nontemporal=*/false,
+ /*alignment=*/mlir::IntegerAttr{}, cir::SyncScopeKindAttr{},
+ cir::MemOrderAttr{}, /*invariant=*/false);
+ }]>
+ ];
+
// FIXME: add verifier.
}
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
index c5c69e3d4067c..e2fe3adefd4af 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
@@ -567,8 +567,7 @@ static RValue emitUnaryMaybeConstrainedFPBuiltin(CIRGenFunction &cgf,
template <class Operation>
static RValue emitUnaryFPBuiltin(CIRGenFunction &cgf, const CallExpr &e) {
mlir::Value arg = cgf.emitScalarExpr(e.getArg(0));
- auto call =
- Operation::create(cgf.getBuilder(), arg.getLoc(), arg.getType(), arg);
+ auto call = Operation::create(cgf.getBuilder(), arg.getLoc(), arg);
return RValue::get(call->getResult(0));
}
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 5eecf4d6c716b..39f7bb13caf08 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -571,7 +571,9 @@ mlir::LogicalResult lowerConstrainableFPOp(
return op->emitError("expected LLVM result type for floating-point op");
if (!fenv) {
- rewriter.replaceOpWithNewOp<LLVMOp>(op, llvmResTy, operands);
+ rewriter.replaceOpWithNewOp<LLVMOp>(
+ op, mlir::TypeRange{llvmResTy}, operands,
+ cir::getDefaultProperties<LLVMOp>(op->getContext()));
return mlir::success();
}
More information about the cfe-commits
mailing list