mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-01 18:12:44 +00:00
[mlir] Fix Python bindings tests failure in Debug mode after D98474
Add extra `type.isa<FloatType>()` check to `FloatAttr::get(Type, double)` method. Otherwise it tries to call `type.cast<FloatType>()`, which fails with assertion in Debug mode. The `!type.isa<FloatType>()` case just redirercts the call to `FloatAttr::get(Type, APFloat)`, which will perform the actual check and emit appropriate error. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D98764
This commit is contained in:
parent
16370e02a7
commit
270a336ff4
@ -406,7 +406,7 @@ def Builtin_FloatAttr : Builtin_Attr<"Float"> {
|
||||
return $_get(type.getContext(), type, value);
|
||||
}]>,
|
||||
AttrBuilderWithInferredContext<(ins "Type":$type, "double":$value), [{
|
||||
if (type.isF64())
|
||||
if (type.isF64() || !type.isa<FloatType>())
|
||||
return $_get(type.getContext(), type, APFloat(value));
|
||||
|
||||
// This handles, e.g., F16 because there is no APFloat constructor for it.
|
||||
|
Loading…
Reference in New Issue
Block a user