File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed
include/mlir/Dialect/LLVMIR Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -1428,7 +1428,8 @@ def LLVM_LLVMFuncOp : LLVM_Op<"func", [
1428
1428
OptionalAttr<LLVM_VScaleRangeAttr>:$vscale_range,
1429
1429
OptionalAttr<FramePointerKindAttr>:$frame_pointer,
1430
1430
OptionalAttr<StrAttr>:$target_cpu,
1431
- OptionalAttr<LLVM_TargetFeaturesAttr>:$target_features
1431
+ OptionalAttr<LLVM_TargetFeaturesAttr>:$target_features,
1432
+ OptionalAttr<BoolAttr>:$unsafe_fp_math
1432
1433
);
1433
1434
1434
1435
let regions = (region AnyRegion:$body);
Original file line number Diff line number Diff line change 37
37
38
38
#include " llvm/ADT/PostOrderIterator.h"
39
39
#include " llvm/ADT/SetVector.h"
40
+ #include " llvm/ADT/StringExtras.h"
40
41
#include " llvm/ADT/TypeSwitch.h"
41
42
#include " llvm/Frontend/OpenMP/OMPIRBuilder.h"
42
43
#include " llvm/IR/BasicBlock.h"
@@ -1214,6 +1215,9 @@ LogicalResult ModuleTranslation::convertOneFunction(LLVMFuncOp func) {
1214
1215
getLLVMContext (), attr->getMinRange ().getInt (),
1215
1216
attr->getMaxRange ().getInt ()));
1216
1217
1218
+ if (auto unsafeFpMath = func.getUnsafeFpMath ())
1219
+ llvmFunc->addFnAttr (" unsafe-fp-math" , llvm::toStringRef (*unsafeFpMath));
1220
+
1217
1221
// Add function attribute frame-pointer, if found.
1218
1222
if (FramePointerKindAttr attr = func.getFramePointerAttr ())
1219
1223
llvmFunc->addFnAttr (" frame-pointer" ,
Original file line number Diff line number Diff line change @@ -257,6 +257,12 @@ module {
257
257
llvm.func @frame_pointer_roundtrip () attributes {frame_pointer = #llvm.framePointerKind <" non-leaf" >} {
258
258
llvm.return
259
259
}
260
+
261
+ llvm.func @unsafe_fp_math_roundtrip () attributes {unsafe_fp_math = true } {
262
+ // CHECK: @unsafe_fp_math_roundtrip
263
+ // CHECK-SAME: attributes {unsafe_fp_math = true}
264
+ llvm.return
265
+ }
260
266
}
261
267
262
268
// -----
You can’t perform that action at this time.
0 commit comments