Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion flang/include/flang/Optimizer/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def FunctionAttr : Pass<"function-attr", "mlir::func::FuncOp"> {
"Set the no-signed-zeros-fp-math attribute on functions in the "
"module.">,
Option<"unsafeFPMath", "unsafe-fp-math", "bool", /*default=*/"false",
"Set the unsafe-fp-math attribute on functions in the module.">,
"Set all fast-math flags on instructions in the module.">,
Option<"reciprocals", "mrecip", "std::string", /*default=*/"",
"Set the reciprocal-estimates attribute on functions in the "
"module.">,
Expand Down
2 changes: 1 addition & 1 deletion flang/include/flang/Tools/CrossToolHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ struct MLIRToLLVMPassPipelineConfig : public FlangEPCallBacks {
bool ApproxFuncFPMath = false; ///< Set afn flag for instructions.
bool NoSignedZerosFPMath =
false; ///< Set no-signed-zeros-fp-math attribute for functions.
bool UnsafeFPMath = false; ///< Set unsafe-fp-math attribute for functions.
bool UnsafeFPMath = false; ///< Set all fast-math flags for instructions.
std::string Reciprocals = ""; ///< Set reciprocal-estimate attribute for
///< functions.
std::string PreferVectorWidth = ""; ///< Set prefer-vector-width attribute for
Expand Down
4 changes: 0 additions & 4 deletions flang/lib/Optimizer/Transforms/FunctionAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ void FunctionAttrPass::runOnOperation() {
func->setAttr(
mlir::LLVM::LLVMFuncOp::getNoSignedZerosFpMathAttrName(llvmFuncOpName),
mlir::BoolAttr::get(context, true));
if (unsafeFPMath)
func->setAttr(
mlir::LLVM::LLVMFuncOp::getUnsafeFpMathAttrName(llvmFuncOpName),
mlir::BoolAttr::get(context, true));
if (!reciprocals.empty())
func->setAttr(
mlir::LLVM::LLVMFuncOp::getReciprocalEstimatesAttrName(llvmFuncOpName),
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Driver/func-attr-fast-math.f90
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ end subroutine func

! CHECK-OFAST-LABEL: define void @func_() local_unnamed_addr
! CHECK-OFAST-SAME: #[[ATTRS:[0-9]+]]
! CHECK-OFAST: attributes #[[ATTRS]] = { {{.*}}"no-infs-fp-math"="true" {{.*}}"no-nans-fp-math"="true" {{.*}}"no-signed-zeros-fp-math"="true" {{.*}}"unsafe-fp-math"="true"{{.*}} }
! CHECK-OFAST: attributes #[[ATTRS]] = { {{.*}}"no-infs-fp-math"="true" {{.*}}"no-nans-fp-math"="true" {{.*}}"no-signed-zeros-fp-math"="true"{{.*}} }

! CHECK-FFAST-MATH-LABEL: define void @func_() local_unnamed_addr
! CHECK-FFAST-MATH-SAME: #[[ATTRS:[0-9]+]]
! CHECK-FFAST-MATH: attributes #[[ATTRS]] = { {{.*}}"no-infs-fp-math"="true" {{.*}}"no-nans-fp-math"="true" {{.*}}"no-signed-zeros-fp-math"="true" {{.*}}"unsafe-fp-math"="true"{{.*}} }
! CHECK-FFAST-MATH: attributes #[[ATTRS]] = { {{.*}}"no-infs-fp-math"="true" {{.*}}"no-nans-fp-math"="true" {{.*}}"no-signed-zeros-fp-math"="true"{{.*}} }