Skip to content

Commit 76f15ea

Browse files
authored
[CodeGen][Target] Remove UnsafeFPMath uses (#164549)
Remove `UnsafeFPMath` uses, next is removing the command line option.
1 parent 14d50bc commit 76f15ea

File tree

5 files changed

+4
-18
lines changed

5 files changed

+4
-18
lines changed

llvm/include/llvm/CodeGen/CommandFlags.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ LLVM_ABI CodeGenFileType getFileType();
5858

5959
LLVM_ABI FramePointerKind getFramePointerUsage();
6060

61-
LLVM_ABI bool getEnableUnsafeFPMath();
62-
6361
LLVM_ABI bool getEnableNoInfsFPMath();
6462

6563
LLVM_ABI bool getEnableNoNaNsFPMath();

llvm/include/llvm/Target/TargetOptions.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,8 @@ enum CodeObjectVersionKind {
118118
class TargetOptions {
119119
public:
120120
TargetOptions()
121-
: UnsafeFPMath(false), NoInfsFPMath(false), NoNaNsFPMath(false),
122-
NoTrappingFPMath(true), NoSignedZerosFPMath(false),
123-
EnableAIXExtendedAltivecABI(false),
121+
: NoInfsFPMath(false), NoNaNsFPMath(false), NoTrappingFPMath(true),
122+
NoSignedZerosFPMath(false), EnableAIXExtendedAltivecABI(false),
124123
HonorSignDependentRoundingFPMathOption(false), NoZerosInBSS(false),
125124
GuaranteedTailCallOpt(false), StackSymbolOrdering(true),
126125
EnableFastISel(false), EnableGlobalISel(false), UseInitArray(false),
@@ -156,13 +155,6 @@ class TargetOptions {
156155
/// MCAsmInfo::BinutilsVersion.
157156
std::pair<int, int> BinutilsVersion{0, 0};
158157

159-
/// UnsafeFPMath - This flag is enabled when the
160-
/// -enable-unsafe-fp-math flag is specified on the command line. When
161-
/// this flag is off (the default), the code generator is not allowed to
162-
/// produce results that are "less precise" than IEEE allows. This includes
163-
/// use of X86 instructions like FSIN and FCOS instead of libcalls.
164-
unsigned UnsafeFPMath : 1;
165-
166158
/// NoInfsFPMath - This flag is enabled when the
167159
/// -enable-no-infs-fp-math flag is specified on the command line. When
168160
/// this flag is off (the default), the code generator is not allowed to

llvm/lib/CodeGen/CommandFlags.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ CGOPT_EXP(uint64_t, LargeDataThreshold)
6464
CGOPT(ExceptionHandling, ExceptionModel)
6565
CGOPT_EXP(CodeGenFileType, FileType)
6666
CGOPT(FramePointerKind, FramePointerUsage)
67-
CGOPT(bool, EnableUnsafeFPMath)
6867
CGOPT(bool, EnableNoInfsFPMath)
6968
CGOPT(bool, EnableNoNaNsFPMath)
7069
CGOPT(bool, EnableNoSignedZerosFPMath)
@@ -219,11 +218,11 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
219218
"Enable frame pointer elimination")));
220219
CGBINDOPT(FramePointerUsage);
221220

221+
[[maybe_unused]]
222222
static cl::opt<bool> EnableUnsafeFPMath(
223223
"enable-unsafe-fp-math",
224224
cl::desc("Enable optimizations that may decrease FP precision"),
225225
cl::init(false));
226-
CGBINDOPT(EnableUnsafeFPMath);
227226

228227
static cl::opt<bool> EnableNoInfsFPMath(
229228
"enable-no-infs-fp-math",
@@ -552,7 +551,6 @@ TargetOptions
552551
codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
553552
TargetOptions Options;
554553
Options.AllowFPOpFusion = getFuseFPOps();
555-
Options.UnsafeFPMath = getEnableUnsafeFPMath();
556554
Options.NoInfsFPMath = getEnableNoInfsFPMath();
557555
Options.NoNaNsFPMath = getEnableNoNaNsFPMath();
558556
Options.NoSignedZerosFPMath = getEnableNoSignedZerosFPMath();
@@ -706,7 +704,6 @@ void codegen::setFunctionAttributes(StringRef CPU, StringRef Features,
706704
if (getStackRealign())
707705
NewAttrs.addAttribute("stackrealign");
708706

709-
HANDLE_BOOL_ATTR(EnableUnsafeFPMathView, "unsafe-fp-math");
710707
HANDLE_BOOL_ATTR(EnableNoInfsFPMathView, "no-infs-fp-math");
711708
HANDLE_BOOL_ATTR(EnableNoNaNsFPMathView, "no-nans-fp-math");
712709
HANDLE_BOOL_ATTR(EnableNoSignedZerosFPMathView, "no-signed-zeros-fp-math");

llvm/lib/CodeGen/TargetOptionsImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ bool TargetOptions::FramePointerIsReserved(const MachineFunction &MF) const {
5151
/// HonorSignDependentRoundingFPMath - Return true if the codegen must assume
5252
/// that the rounding mode of the FPU can change from its default.
5353
bool TargetOptions::HonorSignDependentRoundingFPMath() const {
54-
return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption;
54+
return HonorSignDependentRoundingFPMathOption;
5555
}
5656

5757
/// NOTE: There are targets that still do not support the debug entry values

llvm/lib/Target/TargetMachine.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ void TargetMachine::resetTargetOptions(const Function &F) const {
158158
Options.X = F.getFnAttribute(Y).getValueAsBool(); \
159159
} while (0)
160160

161-
RESET_OPTION(UnsafeFPMath, "unsafe-fp-math");
162161
RESET_OPTION(NoInfsFPMath, "no-infs-fp-math");
163162
RESET_OPTION(NoNaNsFPMath, "no-nans-fp-math");
164163
RESET_OPTION(NoSignedZerosFPMath, "no-signed-zeros-fp-math");

0 commit comments

Comments
 (0)