[PATCH] D80315: Fix CC1 command line options mapping into fast-math flags.
Michele Scandale via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 29 14:46:54 PDT 2020
michele.scandale requested review of this revision.
michele.scandale added a comment.
I've just realized it might be incorrect to have the CC1 option `-ffast-math` changing the default contraction mode. The clang driver generates `-ffast-math` based on conditions that do not involve the contraction mode state at all:
// -ffast-math enables the __FAST_MATH__ preprocessor macro, but check for the
// individual features enabled by -ffast-math instead of the option itself as
// that's consistent with gcc's behaviour.
if (!HonorINFs && !HonorNaNs && !MathErrno && AssociativeMath &&
ReciprocalMath && !SignedZeros && !TrappingMath && !RoundingFPMath) {
CmdArgs.push_back("-ffast-math");
if (FPModel.equals("fast")) {
if (FPContract.equals("fast"))
// All set, do nothing.
;
else if (FPContract.empty())
// Enable -ffp-contract=fast
CmdArgs.push_back(Args.MakeArgString("-ffp-contract=fast"));
else
D.Diag(clang::diag::warn_drv_overriding_flag_option)
<< "-ffp-model=fast"
<< Args.MakeArgString("-ffp-contract=" + FPContract);
}
}
For example the running the following `clang -### -funsafe-math-optimizations -ffinite-math-only -x c -` lead to a CC1 command line without any `-ffp-contract=` option relying on the fact that the default value for the contraction mode in the compiler is OFF.
I will revert the modification on this aspect.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80315/new/
https://reviews.llvm.org/D80315
More information about the cfe-commits
mailing list