[clang] [CIR] Add side effect attribute to call operations (PR #144201)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 16 10:58:55 PDT 2025
================
@@ -1940,22 +1975,30 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> {
let arguments = commonArgs;
let builders = [
- // Build a call op for a direct call
- OpBuilder<(ins "mlir::SymbolRefAttr":$callee, "mlir::Type":$resType,
- "mlir::ValueRange":$operands), [{
+ // Build a call op for a direct call
+ OpBuilder<(ins "mlir::SymbolRefAttr":$callee, "mlir::Type":$resType,
+ "mlir::ValueRange":$operands,
+ CArg<"SideEffect", "SideEffect::All">:$sideEffect),
+ [{
assert(callee && "callee attribute is required for direct call");
$_state.addOperands(operands);
$_state.addAttribute("callee", callee);
+ $_state.addAttribute("side_effect",
+ SideEffectAttr::get($_builder.getContext(), sideEffect));
if (resType && !isa<VoidType>(resType))
$_state.addTypes(resType);
}]>,
- // Build a call op for an indirect call
- OpBuilder<(ins "mlir::Value":$calleePtr, "mlir::Type":$resType,
- "mlir::ValueRange":$operands), [{
+ // Build a call op for an indirect call
+ OpBuilder<(ins "mlir::Value":$calleePtr, "mlir::Type":$resType,
----------------
andykaylor wrote:
Again, indenting is wrong.
https://github.com/llvm/llvm-project/pull/144201
More information about the cfe-commits
mailing list