[PATCH] D81869: Modify FPFeatures to use delta not absolute settings to solve PCH compatibility problems

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 05:56:57 PDT 2020


yaxunl added a comment.

Would you please add the following lit test

F12245277: diff.pch.txt <https://reviews.llvm.org/F12245277>

If you change FastMath, FiniteMathOnly and UnsafeFPMath to COMPATIBLE_LANGOPT, the test should pass.



================
Comment at: clang/include/clang/Basic/LangOptions.def:192
 COMPATIBLE_LANGOPT(Deprecated        , 1, 0, "__DEPRECATED predefined macro")
-COMPATIBLE_LANGOPT(FastMath          , 1, 0, "fast FP math optimizations, and __FAST_MATH__ predefined macro")
-COMPATIBLE_LANGOPT(FiniteMathOnly    , 1, 0, "__FINITE_MATH_ONLY__ predefined macro")
-COMPATIBLE_LANGOPT(UnsafeFPMath      , 1, 0, "Unsafe Floating Point Math")
-COMPATIBLE_LANGOPT(AllowFPReassoc    , 1, 0, "Permit Floating Point reassociation")
-COMPATIBLE_LANGOPT(NoHonorNaNs       , 1, 0, "Permit Floating Point optimization without regard to NaN")
-COMPATIBLE_LANGOPT(NoHonorInfs       , 1, 0, "Permit Floating Point optimization without regard to infinities")
-COMPATIBLE_LANGOPT(NoSignedZero      , 1, 0, "Permit Floating Point optimization without regard to signed zeros")
-COMPATIBLE_LANGOPT(AllowRecip        , 1, 0, "Permit Floating Point reciprocal")
-COMPATIBLE_LANGOPT(ApproxFunc        , 1, 0, "Permit Floating Point approximation")
+BENIGN_LANGOPT(FastMath          , 1, 0, "fast FP math optimizations, and __FAST_MATH__ predefined macro")
+BENIGN_LANGOPT(FiniteMathOnly    , 1, 0, "__FINITE_MATH_ONLY__ predefined macro")
----------------
mibintc wrote:
> Here's another problem, I added the test case from bug 46166 @yaxunl but that test case reports incompatibility because the pch is compiled with different settings than where it is used. I thought maybe based on the name, BENIGN_LANGOPT would  allow different option values to not get the pch complaint but that didn't work, clang still complained about the different option values.  Is there some existing way to get around the option complaint or do I need to invent a new field in the LANGOPT e.g. a boolean that says "Allow opton values to differ between pch-create and pch-use".  I haven't deeply studied this to see if I'm missing something. I wanted to send this out to get comments on my other questions 
can you make FastMath, FiniteMathOnly and UnsafeFPMath COMPATIBLE_LANGOPT as before? This allows users to use -fno-validate-pch to relax the check on them. This is the old behavior and I do not see a reason to change that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81869/new/

https://reviews.llvm.org/D81869





More information about the llvm-commits mailing list