Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,11 @@ def LLVM_CallIntrinsicOp
attr-dict
}];

let builders = [
OpBuilder<(ins "Type": $results, "StringAttr":$intrin, "ValueRange":$args)>,
OpBuilder<(ins "TypeRange": $results, "StringAttr":$intrin, "ValueRange":$args, "FastmathFlagsAttr":$fastMathFlags)>
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could also include builders for intrinsics that do not have a result type?

OpBuilder<(ins "StringAttr":$intrin, "ValueRange":$args)>
OpBuilder<(ins "StringAttr":$intrin, "ValueRange":$args, "FastmathFlagsAttr":$fastMathFlags)>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review.
I've added those in. Do you know how I could confirm they work? I don't really have a use cause so I was just guessing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another approach might be adding a unit test under mlir/unittests/Dialect/LLVMIR. But it seems like few people ever do this ... Anyway this builder is fairly simple and I believe it should be OK if no reviewers have problems about it.


let hasVerifier = 1;
}

Expand Down
19 changes: 19 additions & 0 deletions mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3353,6 +3353,25 @@ struct LLVMOpAsmDialectInterface : public OpAsmDialectInterface {
};
} // namespace

//===----------------------------------------------------------------------===//
// CallIntrinsicOp
//===----------------------------------------------------------------------===//

void CallIntrinsicOp::build(OpBuilder &builder, OperationState &state,
mlir::TypeRange results, mlir::StringAttr intrin,
mlir::ValueRange args,
mlir::LLVM::FastmathFlagsAttr fastMathFlags) {

build(builder, state, results, intrin, args, fastMathFlags,
llvm::ArrayRef<mlir::ValueRange>{});
}
void CallIntrinsicOp::build(OpBuilder &builder, OperationState &state,
mlir::Type results, mlir::StringAttr intrin,
mlir::ValueRange args) {
build(builder, state, {results}, intrin, args, FastmathFlagsAttr{},
llvm::ArrayRef<mlir::ValueRange>{});
}

//===----------------------------------------------------------------------===//
// LinkerOptionsOp
//===----------------------------------------------------------------------===//
Expand Down
Loading