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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 10:18:19 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);
----------------
arsenm wrote:

This should be the same as II.isStrictFP above. However, is.fpclass would never be strict, so I'm not sure why this is checking that.

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


More information about the llvm-commits mailing list