The revision specifies more precise argument and result type
constraints for many of the llvm intrinsics. Additionally, add
tests to verify intrinsics with invalid arguments/result result
in a verification error.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td | ||
---|---|---|
21 | I suspect we want AnySignlessInteger here and below, MLIR integers can have signs and we don't want those in the LLVM intrinsics. | |
mlir/test/Target/LLVMIR/llvmir-invalid.mlir | ||
138 | Nit: FileCheck now supports @below instead of @+1 that reads better and works when combining errors and notes. |
Address comments:
- use @below instead of @+1
- use AnySignlessInteger for all intrinsics
Rebase (after https://reviews.llvm.org/D136498):
- use qualified(type($ptr)) for arguments of type LLVM_AnyPointer
- adapt expected error messages
@dcaballe I changed the integer type constraints on the vector predicate intrinsics from AnyInteger to AnySignlessInteger as well. I hope this does not conflict with your changes.
mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td | ||
---|---|---|
310 | Could you comment on why we need this vs just taking a fast math flags attr ? |
mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td | ||
---|---|---|
310 | As far as I remember the reason for this was that vector reduction instructions only support allowReassoc (they do not have a fast math flag attribute attached). I would assume that is a limitation of the op itself and I didn't want to change the op semantics at the time. If LLVM IR actually supports the full fastmath attribute it could be added to the LLVM dialect operation as well. |
mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td | ||
---|---|---|
310 | It seems like the reassoc is the only thing that is supported on these intrinsics: %unord = call reassoc float @llvm.vector.reduce.fmul.v4f32(float 1.0, <4 x float> %input) ; relaxed reduction At least this is mentioned specifically in the language ref https://llvm.org/docs/LangRef.html#id826 |
I suspect we want AnySignlessInteger here and below, MLIR integers can have signs and we don't want those in the LLVM intrinsics.