[llvm] [InstCombine] Don't add fcmp instructions to strictfp functions (PR #81498)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 10:54:24 PST 2024


================
@@ -903,6 +903,10 @@ Instruction *InstCombinerImpl::foldIntrinsicIsFPClass(IntrinsicInst &II) {
   const FPClassTest OrderedInvertedMask = ~OrderedMask & ~fcNan;
 
   const bool IsStrict = II.isStrictFP();
+  // An fcmp instruction can raise floating-point exceptions, so we can't
+  // introduce new ones if the enclosing function has the strictfp attribute.
+  const bool CanIntroduceFCmp =
+      !II.getFunction()->getAttributes().hasFnAttr(Attribute::StrictFP);
----------------
ostannard wrote:

`II.getFunction()` is checking the function which contains this call, not the intrinsic. Since `is.fpclass` can never be strict, I'll replace the old check with the new one, instead of having both.

https://github.com/llvm/llvm-project/pull/81498


More information about the llvm-commits mailing list