[llvm] [IR][CodeGen] Replace constrained FP intrinsics with fp.control/fp.except operand bundles (PR #191613)

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 11 03:14:52 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- llvm/include/llvm/ADT/FloatingPointMode.h llvm/include/llvm/CodeGen/BasicTTIImpl.h llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h llvm/include/llvm/CodeGen/ISDOpcodes.h llvm/include/llvm/CodeGen/TargetLowering.h llvm/include/llvm/IR/FPEnv.h llvm/include/llvm/IR/IRBuilder.h llvm/include/llvm/IR/InstrTypes.h llvm/include/llvm/IR/IntrinsicInst.h llvm/include/llvm/IR/LLVMContext.h llvm/include/llvm/IR/Type.h llvm/include/llvm/Support/ModRef.h llvm/lib/Analysis/ConstantFolding.cpp llvm/lib/Analysis/InstructionSimplify.cpp llvm/lib/Analysis/ValueTracking.cpp llvm/lib/CodeGen/ExpandVectorPredication.cpp llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h llvm/lib/CodeGen/TargetLoweringBase.cpp llvm/lib/IR/AutoUpgrade.cpp llvm/lib/IR/FPEnv.cpp llvm/lib/IR/IRBuilder.cpp llvm/lib/IR/Instructions.cpp llvm/lib/IR/IntrinsicInst.cpp llvm/lib/IR/Intrinsics.cpp llvm/lib/IR/LLVMContext.cpp llvm/lib/IR/Type.cpp llvm/lib/IR/Verifier.cpp llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp llvm/lib/Transforms/Scalar/EarlyCSE.cpp llvm/lib/Transforms/Utils/CloneFunction.cpp llvm/lib/Transforms/Utils/Local.cpp llvm/unittests/Bitcode/BitReaderTest.cpp llvm/unittests/IR/IRBuilderTest.cpp llvm/unittests/IR/InstructionsTest.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index de0f59bd0..8bad6457c 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -1343,55 +1343,151 @@ public:
     unsigned EqOpc;
     switch (Op) {
       default: llvm_unreachable("Unexpected FP pseudo-opcode");
-      case ISD::STRICT_FADD: EqOpc = ISD::FADD; break;
-      case ISD::STRICT_FSUB: EqOpc = ISD::FSUB; break;
-      case ISD::STRICT_FMUL: EqOpc = ISD::FMUL; break;
-      case ISD::STRICT_FDIV: EqOpc = ISD::FDIV; break;
-      case ISD::STRICT_FREM: EqOpc = ISD::FREM; break;
-      case ISD::STRICT_FP_EXTEND: EqOpc = ISD::FP_EXTEND; break;
-      case ISD::STRICT_SINT_TO_FP: EqOpc = ISD::SINT_TO_FP; break;
-      case ISD::STRICT_UINT_TO_FP: EqOpc = ISD::UINT_TO_FP; break;
-      case ISD::STRICT_FP_TO_SINT: EqOpc = ISD::FP_TO_SINT; break;
-      case ISD::STRICT_FP_TO_UINT: EqOpc = ISD::FP_TO_UINT; break;
-      case ISD::STRICT_FP_ROUND: EqOpc = ISD::FP_ROUND; break;
-      case ISD::STRICT_FACOS: EqOpc = ISD::FACOS; break;
-      case ISD::STRICT_FASIN: EqOpc = ISD::FASIN; break;
-      case ISD::STRICT_FATAN: EqOpc = ISD::FATAN; break;
-      case ISD::STRICT_FATAN2: EqOpc = ISD::FATAN2; break;
-      case ISD::STRICT_FCEIL: EqOpc = ISD::FCEIL; break;
-      case ISD::STRICT_FCOS: EqOpc = ISD::FCOS; break;
-      case ISD::STRICT_FCOSH: EqOpc = ISD::FCOSH; break;
-      case ISD::STRICT_FEXP: EqOpc = ISD::FEXP; break;
-      case ISD::STRICT_FEXP2: EqOpc = ISD::FEXP2; break;
-      case ISD::STRICT_FFLOOR: EqOpc = ISD::FFLOOR; break;
-      case ISD::STRICT_FMA: EqOpc = ISD::FMA; break;
-      case ISD::STRICT_FLOG: EqOpc = ISD::FLOG; break;
-      case ISD::STRICT_FLOG10: EqOpc = ISD::FLOG10; break;
-      case ISD::STRICT_FLOG2: EqOpc = ISD::FLOG2; break;
-      case ISD::STRICT_LRINT: EqOpc = ISD::LRINT; break;
-      case ISD::STRICT_LLRINT: EqOpc = ISD::LLRINT; break;
-      case ISD::STRICT_LROUND: EqOpc = ISD::LROUND; break;
-      case ISD::STRICT_LLROUND: EqOpc = ISD::LLROUND; break;
-      case ISD::STRICT_FMAXNUM: EqOpc = ISD::FMAXNUM; break;
-      case ISD::STRICT_FMINNUM: EqOpc = ISD::FMINNUM; break;
-      case ISD::STRICT_FMAXIMUM: EqOpc = ISD::FMAXIMUM; break;
-      case ISD::STRICT_FMINIMUM: EqOpc = ISD::FMINIMUM; break;
-      case ISD::STRICT_FNEARBYINT: EqOpc = ISD::FNEARBYINT; break;
-      case ISD::STRICT_FPOW: EqOpc = ISD::FPOW; break;
-      case ISD::STRICT_FPOWI: EqOpc = ISD::FPOWI; break;
-      case ISD::STRICT_FLDEXP: EqOpc = ISD::FLDEXP; break;
-      case ISD::STRICT_FRINT: EqOpc = ISD::FRINT; break;
-      case ISD::STRICT_FROUND: EqOpc = ISD::FROUND; break;
-      case ISD::STRICT_FROUNDEVEN: EqOpc = ISD::FROUNDEVEN; break;
-      case ISD::STRICT_FSIN: EqOpc = ISD::FSIN; break;
-      case ISD::STRICT_FSINH: EqOpc = ISD::FSINH; break;
-      case ISD::STRICT_FSQRT: EqOpc = ISD::FSQRT; break;
-      case ISD::STRICT_FTAN: EqOpc = ISD::FTAN; break;
-      case ISD::STRICT_FTANH: EqOpc = ISD::FTANH; break;
-      case ISD::STRICT_FTRUNC: EqOpc = ISD::FTRUNC; break;
-      case ISD::STRICT_FSETCC: EqOpc = ISD::SETCC; break;
-      case ISD::STRICT_FSETCCS: EqOpc = ISD::SETCC; break;
-    }
+      case ISD::STRICT_FADD:
+        EqOpc = ISD::FADD;
+        break;
+      case ISD::STRICT_FSUB:
+        EqOpc = ISD::FSUB;
+        break;
+      case ISD::STRICT_FMUL:
+        EqOpc = ISD::FMUL;
+        break;
+      case ISD::STRICT_FDIV:
+        EqOpc = ISD::FDIV;
+        break;
+      case ISD::STRICT_FREM:
+        EqOpc = ISD::FREM;
+        break;
+      case ISD::STRICT_FP_EXTEND:
+        EqOpc = ISD::FP_EXTEND;
+        break;
+      case ISD::STRICT_SINT_TO_FP:
+        EqOpc = ISD::SINT_TO_FP;
+        break;
+      case ISD::STRICT_UINT_TO_FP:
+        EqOpc = ISD::UINT_TO_FP;
+        break;
+      case ISD::STRICT_FP_TO_SINT:
+        EqOpc = ISD::FP_TO_SINT;
+        break;
+      case ISD::STRICT_FP_TO_UINT:
+        EqOpc = ISD::FP_TO_UINT;
+        break;
+      case ISD::STRICT_FP_ROUND:
+        EqOpc = ISD::FP_ROUND;
+        break;
+      case ISD::STRICT_FACOS:
+        EqOpc = ISD::FACOS;
+        break;
+      case ISD::STRICT_FASIN:
+        EqOpc = ISD::FASIN;
+        break;
+      case ISD::STRICT_FATAN:
+        EqOpc = ISD::FATAN;
+        break;
+      case ISD::STRICT_FATAN2:
+        EqOpc = ISD::FATAN2;
+        break;
+      case ISD::STRICT_FCEIL:
+        EqOpc = ISD::FCEIL;
+        break;
+      case ISD::STRICT_FCOS:
+        EqOpc = ISD::FCOS;
+        break;
+      case ISD::STRICT_FCOSH:
+        EqOpc = ISD::FCOSH;
+        break;
+      case ISD::STRICT_FEXP:
+        EqOpc = ISD::FEXP;
+        break;
+      case ISD::STRICT_FEXP2:
+        EqOpc = ISD::FEXP2;
+        break;
+      case ISD::STRICT_FFLOOR:
+        EqOpc = ISD::FFLOOR;
+        break;
+      case ISD::STRICT_FMA:
+        EqOpc = ISD::FMA;
+        break;
+      case ISD::STRICT_FLOG:
+        EqOpc = ISD::FLOG;
+        break;
+      case ISD::STRICT_FLOG10:
+        EqOpc = ISD::FLOG10;
+        break;
+      case ISD::STRICT_FLOG2:
+        EqOpc = ISD::FLOG2;
+        break;
+      case ISD::STRICT_LRINT:
+        EqOpc = ISD::LRINT;
+        break;
+      case ISD::STRICT_LLRINT:
+        EqOpc = ISD::LLRINT;
+        break;
+      case ISD::STRICT_LROUND:
+        EqOpc = ISD::LROUND;
+        break;
+      case ISD::STRICT_LLROUND:
+        EqOpc = ISD::LLROUND;
+        break;
+      case ISD::STRICT_FMAXNUM:
+        EqOpc = ISD::FMAXNUM;
+        break;
+      case ISD::STRICT_FMINNUM:
+        EqOpc = ISD::FMINNUM;
+        break;
+      case ISD::STRICT_FMAXIMUM:
+        EqOpc = ISD::FMAXIMUM;
+        break;
+      case ISD::STRICT_FMINIMUM:
+        EqOpc = ISD::FMINIMUM;
+        break;
+      case ISD::STRICT_FNEARBYINT:
+        EqOpc = ISD::FNEARBYINT;
+        break;
+      case ISD::STRICT_FPOW:
+        EqOpc = ISD::FPOW;
+        break;
+      case ISD::STRICT_FPOWI:
+        EqOpc = ISD::FPOWI;
+        break;
+      case ISD::STRICT_FLDEXP:
+        EqOpc = ISD::FLDEXP;
+        break;
+      case ISD::STRICT_FRINT:
+        EqOpc = ISD::FRINT;
+        break;
+      case ISD::STRICT_FROUND:
+        EqOpc = ISD::FROUND;
+        break;
+      case ISD::STRICT_FROUNDEVEN:
+        EqOpc = ISD::FROUNDEVEN;
+        break;
+      case ISD::STRICT_FSIN:
+        EqOpc = ISD::FSIN;
+        break;
+      case ISD::STRICT_FSINH:
+        EqOpc = ISD::FSINH;
+        break;
+      case ISD::STRICT_FSQRT:
+        EqOpc = ISD::FSQRT;
+        break;
+      case ISD::STRICT_FTAN:
+        EqOpc = ISD::FTAN;
+        break;
+      case ISD::STRICT_FTANH:
+        EqOpc = ISD::FTANH;
+        break;
+      case ISD::STRICT_FTRUNC:
+        EqOpc = ISD::FTRUNC;
+        break;
+      case ISD::STRICT_FSETCC:
+        EqOpc = ISD::SETCC;
+        break;
+      case ISD::STRICT_FSETCCS:
+        EqOpc = ISD::SETCC;
+        break;
+      }
 
     return getOperationAction(EqOpc, VT);
   }
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 391b5fee3..c57495812 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -1644,8 +1644,8 @@ public:
   Value *CreateFAddFMF(Value *L, Value *R, FMFSource FMFSource,
                        const Twine &Name = "", MDNode *FPMD = nullptr) {
     if (IsFPConstrained && hasNonDefaultFPConstraints())
-      return CreateIntrinsic(Intrinsic::fadd, {L->getType()}, {L, R},
-                             FMFSource, Name);
+      return CreateIntrinsic(Intrinsic::fadd, {L->getType()}, {L, R}, FMFSource,
+                             Name);
 
     if (Value *V =
             Folder.FoldBinOpFMF(Instruction::FAdd, L, R, FMFSource.get(FMF)))
@@ -1663,8 +1663,8 @@ public:
   Value *CreateFSubFMF(Value *L, Value *R, FMFSource FMFSource,
                        const Twine &Name = "", MDNode *FPMD = nullptr) {
     if (IsFPConstrained && hasNonDefaultFPConstraints())
-      return CreateIntrinsic(Intrinsic::fsub, {L->getType()}, {L, R},
-                             FMFSource, Name);
+      return CreateIntrinsic(Intrinsic::fsub, {L->getType()}, {L, R}, FMFSource,
+                             Name);
 
     if (Value *V =
             Folder.FoldBinOpFMF(Instruction::FSub, L, R, FMFSource.get(FMF)))
@@ -1682,8 +1682,8 @@ public:
   Value *CreateFMulFMF(Value *L, Value *R, FMFSource FMFSource,
                        const Twine &Name = "", MDNode *FPMD = nullptr) {
     if (IsFPConstrained && hasNonDefaultFPConstraints())
-      return CreateIntrinsic(Intrinsic::fmul, {L->getType()}, {L, R},
-                             FMFSource, Name);
+      return CreateIntrinsic(Intrinsic::fmul, {L->getType()}, {L, R}, FMFSource,
+                             Name);
 
     if (Value *V =
             Folder.FoldBinOpFMF(Instruction::FMul, L, R, FMFSource.get(FMF)))
@@ -1701,8 +1701,8 @@ public:
   Value *CreateFDivFMF(Value *L, Value *R, FMFSource FMFSource,
                        const Twine &Name = "", MDNode *FPMD = nullptr) {
     if (IsFPConstrained && hasNonDefaultFPConstraints())
-      return CreateIntrinsic(Intrinsic::fdiv, {L->getType()}, {L, R},
-                             FMFSource, Name);
+      return CreateIntrinsic(Intrinsic::fdiv, {L->getType()}, {L, R}, FMFSource,
+                             Name);
 
     if (Value *V =
             Folder.FoldBinOpFMF(Instruction::FDiv, L, R, FMFSource.get(FMF)))
@@ -1720,8 +1720,8 @@ public:
   Value *CreateFRemFMF(Value *L, Value *R, FMFSource FMFSource,
                        const Twine &Name = "", MDNode *FPMD = nullptr) {
     if (IsFPConstrained && hasNonDefaultFPConstraints())
-      return CreateIntrinsic(Intrinsic::frem, {L->getType()}, {L, R},
-                             FMFSource, Name);
+      return CreateIntrinsic(Intrinsic::frem, {L->getType()}, {L, R}, FMFSource,
+                             Name);
 
     if (Value *V =
             Folder.FoldBinOpFMF(Instruction::FRem, L, R, FMFSource.get(FMF)))
@@ -2100,23 +2100,23 @@ public:
 
   Value *CreateFPToUI(Value *V, Type *DestTy, const Twine &Name = "") {
     if (IsFPConstrained && hasNonDefaultFPConstraints())
-      return CreateIntrinsic(Intrinsic::fptoui, {DestTy, V->getType()}, {V},
-                             {}, Name);
+      return CreateIntrinsic(Intrinsic::fptoui, {DestTy, V->getType()}, {V}, {},
+                             Name);
     return CreateCast(Instruction::FPToUI, V, DestTy, Name);
   }
 
   Value *CreateFPToSI(Value *V, Type *DestTy, const Twine &Name = "") {
     if (IsFPConstrained && hasNonDefaultFPConstraints())
-      return CreateIntrinsic(Intrinsic::fptosi, {DestTy, V->getType()}, {V},
-                             {}, Name);
+      return CreateIntrinsic(Intrinsic::fptosi, {DestTy, V->getType()}, {V}, {},
+                             Name);
     return CreateCast(Instruction::FPToSI, V, DestTy, Name);
   }
 
   Value *CreateUIToFP(Value *V, Type *DestTy, const Twine &Name = "",
                       bool IsNonNeg = false) {
     if (IsFPConstrained && hasNonDefaultFPConstraints())
-      return CreateIntrinsic(Intrinsic::uitofp, {DestTy, V->getType()}, {V},
-                             {}, Name);
+      return CreateIntrinsic(Intrinsic::uitofp, {DestTy, V->getType()}, {V}, {},
+                             Name);
     if (Value *Folded = Folder.FoldCast(Instruction::UIToFP, V, DestTy))
       return Folded;
     Instruction *I = Insert(new UIToFPInst(V, DestTy), Name);
@@ -2127,8 +2127,8 @@ public:
 
   Value *CreateSIToFP(Value *V, Type *DestTy, const Twine &Name = ""){
     if (IsFPConstrained && hasNonDefaultFPConstraints())
-      return CreateIntrinsic(Intrinsic::sitofp, {DestTy, V->getType()}, {V},
-                             {}, Name);
+      return CreateIntrinsic(Intrinsic::sitofp, {DestTy, V->getType()}, {V}, {},
+                             Name);
     return CreateCast(Instruction::SIToFP, V, DestTy, Name);
   }
 
diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index 5f3f0b57f..81e6605e9 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -655,7 +655,6 @@ public:
   // Equivalent non-predicated intrinsic ID
   LLVM_ABI static std::optional<Intrinsic::ID>
   getFunctionalIntrinsicIDForVP(Intrinsic::ID ID);
-
 };
 
 /// This represents vector predication reduction intrinsics.
@@ -727,8 +726,6 @@ public:
   /// @}
 };
 
-
-
 /// This class represents min/max intrinsics.
 class MinMaxIntrinsic : public IntrinsicInst {
 public:
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index be4826467..e2fd15b94 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -2311,8 +2311,7 @@ static bool getConstIntOrUndef(Value *Op, const APInt *&C) {
 ///
 /// \param CI Constrained intrinsic call.
 /// \param St Exception flags raised during constant evaluation.
-static bool mayFoldConstrained(const CallBase *CI,
-                               APFloat::opStatus St) {
+static bool mayFoldConstrained(const CallBase *CI, APFloat::opStatus St) {
   RoundingMode ORM = CI->getRoundingMode();
   fp::ExceptionBehavior EB = CI->getExceptionBehavior();
 
@@ -2345,8 +2344,8 @@ static bool mayFoldNewFPIntrinsic(const CallBase *CI, APFloat::opStatus St) {
     return true;
 
   // If evaluation raised an FP exception, the result can depend on the rounding
-  // mode.  If the rounding mode is dynamic (unknown at compile time), folding is
-  // not safe.
+  // mode.  If the rounding mode is dynamic (unknown at compile time), folding
+  // is not safe.
   if (CI->getRoundingMode() == RoundingMode::Dynamic)
     return false;
 
@@ -2371,8 +2370,7 @@ static RoundingMode getEvaluationRoundingModeForNewFP(const CallBase *CI) {
 }
 
 /// Returns the rounding mode that should be used for constant evaluation.
-static RoundingMode
-getEvaluationRoundingMode(const CallBase *CI) {
+static RoundingMode getEvaluationRoundingMode(const CallBase *CI) {
   RoundingMode ORM = CI->getRoundingMode();
   if (ORM == RoundingMode::Dynamic)
     // Even if the rounding mode is unknown, try evaluating the operation.
@@ -2620,8 +2618,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
     if (RM) {
       if (U.isFinite()) {
         APFloat::opStatus St = U.roundToIntegral(*RM);
-        if (IntrinsicID == Intrinsic::rint &&
-            St == APFloat::opInexact) {
+        if (IntrinsicID == Intrinsic::rint && St == APFloat::opInexact) {
           fp::ExceptionBehavior EB = Call->getExceptionBehavior();
           if (EB == fp::ebStrict)
             return nullptr;
@@ -3188,8 +3185,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
 static Constant *evaluateCompare(const APFloat &Op1, const APFloat &Op2,
                                  const IntrinsicInst *Call) {
   APFloat::opStatus St = APFloat::opOK;
-  Metadata *MD =
-      cast<MetadataAsValue>(Call->getArgOperand(2))->getMetadata();
+  Metadata *MD = cast<MetadataAsValue>(Call->getArgOperand(2))->getMetadata();
   FCmpInst::Predicate Cond =
       StringSwitch<FCmpInst::Predicate>(cast<MDString>(MD)->getString())
           .Case("oeq", FCmpInst::FCMP_OEQ)
@@ -3421,11 +3417,21 @@ static Constant *ConstantFoldIntrinsicCall2(Intrinsic::ID IntrinsicID, Type *Ty,
         switch (IntrinsicID) {
         default:
           llvm_unreachable("unexpected intrinsic");
-        case Intrinsic::fadd: St = Res.add(Op2V, RM); break;
-        case Intrinsic::fsub: St = Res.subtract(Op2V, RM); break;
-        case Intrinsic::fmul: St = Res.multiply(Op2V, RM); break;
-        case Intrinsic::fdiv: St = Res.divide(Op2V, RM); break;
-        case Intrinsic::frem: St = Res.mod(Op2V); break;
+        case Intrinsic::fadd:
+          St = Res.add(Op2V, RM);
+          break;
+        case Intrinsic::fsub:
+          St = Res.subtract(Op2V, RM);
+          break;
+        case Intrinsic::fmul:
+          St = Res.multiply(Op2V, RM);
+          break;
+        case Intrinsic::fdiv:
+          St = Res.divide(Op2V, RM);
+          break;
+        case Intrinsic::frem:
+          St = Res.mod(Op2V);
+          break;
         }
         if (mayFoldNewFPIntrinsic(Call, St)) {
           DenormalMode::DenormalModeKind Mode = *Call->getOutputDenormMode();
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 194960b18..09831b9d3 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -7492,7 +7492,9 @@ Value *llvm::simplifyCall(CallBase *Call, Value *Callee, ArrayRef<Value *> Args,
 }
 
 Value *llvm::simplifyConstrainedFPCall(CallBase *Call, const SimplifyQuery &Q) {
-  assert(isa<IntrinsicInst>(Call) && Intrinsic::isConstrainedFPIntrinsic(cast<IntrinsicInst>(Call)->getIntrinsicID()));
+  assert(isa<IntrinsicInst>(Call) &&
+         Intrinsic::isConstrainedFPIntrinsic(
+             cast<IntrinsicInst>(Call)->getIntrinsicID()));
   SmallVector<Value *, 4> Args(Call->args());
   if (Value *V = tryConstantFoldCall(Call, Call->getCalledOperand(), Args, Q))
     return V;
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 4a5d3b665..1ecf4eaff 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -2091,15 +2091,24 @@ bool IRTranslator::translateSimpleIntrinsic(const CallInst &CI,
 /// opcode, or return 0 if no strict form is available.
 static unsigned getBundledFPStrictGOpcode(Intrinsic::ID ID) {
   switch (ID) {
-  case Intrinsic::fadd: return TargetOpcode::G_STRICT_FADD;
-  case Intrinsic::fsub: return TargetOpcode::G_STRICT_FSUB;
-  case Intrinsic::fmul: return TargetOpcode::G_STRICT_FMUL;
-  case Intrinsic::fdiv: return TargetOpcode::G_STRICT_FDIV;
-  case Intrinsic::frem: return TargetOpcode::G_STRICT_FREM;
-  case Intrinsic::fma:  return TargetOpcode::G_STRICT_FMA;
-  case Intrinsic::sqrt: return TargetOpcode::G_STRICT_FSQRT;
-  case Intrinsic::ldexp: return TargetOpcode::G_STRICT_FLDEXP;
-  default: return 0;
+  case Intrinsic::fadd:
+    return TargetOpcode::G_STRICT_FADD;
+  case Intrinsic::fsub:
+    return TargetOpcode::G_STRICT_FSUB;
+  case Intrinsic::fmul:
+    return TargetOpcode::G_STRICT_FMUL;
+  case Intrinsic::fdiv:
+    return TargetOpcode::G_STRICT_FDIV;
+  case Intrinsic::frem:
+    return TargetOpcode::G_STRICT_FREM;
+  case Intrinsic::fma:
+    return TargetOpcode::G_STRICT_FMA;
+  case Intrinsic::sqrt:
+    return TargetOpcode::G_STRICT_FSQRT;
+  case Intrinsic::ldexp:
+    return TargetOpcode::G_STRICT_FLDEXP;
+  default:
+    return 0;
   }
 }
 
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index d3b269f5a..87f219197 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3686,10 +3686,8 @@ void SelectionDAGBuilder::visitUnreachable(const UnreachableInst &I) {
 static bool hasNonDefaultFPBundles(const CallBase &CB) {
   // If no fp.control or fp.except bundles are present at all, the call uses
   // the default FP environment — do not treat it as non-default.
-  bool HasControl =
-      CB.getOperandBundle(LLVMContext::OB_fp_control).has_value();
-  bool HasExcept =
-      CB.getOperandBundle(LLVMContext::OB_fp_except).has_value();
+  bool HasControl = CB.getOperandBundle(LLVMContext::OB_fp_control).has_value();
+  bool HasExcept = CB.getOperandBundle(LLVMContext::OB_fp_except).has_value();
   if (!HasControl && !HasExcept)
     return false;
   // Bundles are present; check whether they request non-default behavior.
@@ -6670,11 +6668,20 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
   // Route new-form FP intrinsics with non-default bundles to STRICT_* SDNodes.
   if (hasNonDefaultFPBundles(I)) {
     switch (Intrinsic) {
-    case Intrinsic::fadd: case Intrinsic::fsub:  case Intrinsic::fmul:
-    case Intrinsic::fdiv: case Intrinsic::frem:  case Intrinsic::fma:
-    case Intrinsic::sqrt: case Intrinsic::fptoui: case Intrinsic::fptosi:
-    case Intrinsic::uitofp: case Intrinsic::sitofp:
-    case Intrinsic::fptrunc: case Intrinsic::fpext: case Intrinsic::fcmp:
+    case Intrinsic::fadd:
+    case Intrinsic::fsub:
+    case Intrinsic::fmul:
+    case Intrinsic::fdiv:
+    case Intrinsic::frem:
+    case Intrinsic::fma:
+    case Intrinsic::sqrt:
+    case Intrinsic::fptoui:
+    case Intrinsic::fptosi:
+    case Intrinsic::uitofp:
+    case Intrinsic::sitofp:
+    case Intrinsic::fptrunc:
+    case Intrinsic::fpext:
+    case Intrinsic::fcmp:
       visitBundledFPIntrinsicAsStrict(cast<IntrinsicInst>(I));
       return;
     default:
@@ -7216,8 +7223,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
     return;
   }
   case Intrinsic::fcmp: {
-    Metadata *MD =
-        cast<MetadataAsValue>(I.getArgOperand(2))->getMetadata();
+    Metadata *MD = cast<MetadataAsValue>(I.getArgOperand(2))->getMetadata();
     FCmpInst::Predicate Pred =
         StringSwitch<FCmpInst::Predicate>(cast<MDString>(MD)->getString())
             .Case("oeq", FCmpInst::FCMP_OEQ)
@@ -7239,10 +7245,8 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
            "invalid predicate in llvm.fcmp");
     ISD::CondCode Condition = getFCmpCondCode(Pred);
     EVT DestVT = TLI.getValueType(DAG.getDataLayout(), I.getType());
-    setValue(&I, DAG.getSetCC(sdl, DestVT,
-                              getValue(I.getArgOperand(0)),
-                              getValue(I.getArgOperand(1)),
-                              Condition));
+    setValue(&I, DAG.getSetCC(sdl, DestVT, getValue(I.getArgOperand(0)),
+                              getValue(I.getArgOperand(1)), Condition));
     return;
   }
   case Intrinsic::fma:
@@ -7266,10 +7270,9 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
     SDNodeFlags TruncFlags;
     TruncFlags.copyFMF(*cast<FPMathOperator>(&I));
     SelectionDAG::FlagInserter FlagsInserter(DAG, TruncFlags);
-    setValue(&I, DAG.getNode(ISD::FPTRUNC_ROUND, sdl, VT,
-                             getValue(I.getArgOperand(0)),
-                             DAG.getTargetConstant((int)*RoundMode, sdl,
-                                                   MVT::i32)));
+    setValue(&I, DAG.getNode(
+                     ISD::FPTRUNC_ROUND, sdl, VT, getValue(I.getArgOperand(0)),
+                     DAG.getTargetConstant((int)*RoundMode, sdl, MVT::i32)));
 
     return;
   }
@@ -8728,23 +8731,54 @@ void SelectionDAGBuilder::visitBundledFPIntrinsicAsStrict(
 
   unsigned Opcode;
   switch (IID) {
-  case Intrinsic::fadd:    Opcode = ISD::STRICT_FADD;       break;
-  case Intrinsic::fsub:    Opcode = ISD::STRICT_FSUB;       break;
-  case Intrinsic::fmul:    Opcode = ISD::STRICT_FMUL;       break;
-  case Intrinsic::fdiv:    Opcode = ISD::STRICT_FDIV;       break;
-  case Intrinsic::frem:    Opcode = ISD::STRICT_FREM;       break;
-  case Intrinsic::fma:     Opcode = ISD::STRICT_FMA;        break;
-  case Intrinsic::sqrt:    Opcode = ISD::STRICT_FSQRT;      break;
-  case Intrinsic::fptoui:  Opcode = ISD::STRICT_FP_TO_UINT; break;
-  case Intrinsic::fptosi:  Opcode = ISD::STRICT_FP_TO_SINT; break;
-  case Intrinsic::uitofp:  Opcode = ISD::STRICT_UINT_TO_FP; break;
-  case Intrinsic::sitofp:  Opcode = ISD::STRICT_SINT_TO_FP; break;
-  case Intrinsic::fptrunc: Opcode = ISD::STRICT_FP_ROUND;   break;
-  case Intrinsic::fpext:   Opcode = ISD::STRICT_FP_EXTEND;  break;
-  case Intrinsic::fcmp:    Opcode = ISD::STRICT_FSETCC;     break;
-  case Intrinsic::fcmps:   Opcode = ISD::STRICT_FSETCCS;    break;
+  case Intrinsic::fadd:
+    Opcode = ISD::STRICT_FADD;
+    break;
+  case Intrinsic::fsub:
+    Opcode = ISD::STRICT_FSUB;
+    break;
+  case Intrinsic::fmul:
+    Opcode = ISD::STRICT_FMUL;
+    break;
+  case Intrinsic::fdiv:
+    Opcode = ISD::STRICT_FDIV;
+    break;
+  case Intrinsic::frem:
+    Opcode = ISD::STRICT_FREM;
+    break;
+  case Intrinsic::fma:
+    Opcode = ISD::STRICT_FMA;
+    break;
+  case Intrinsic::sqrt:
+    Opcode = ISD::STRICT_FSQRT;
+    break;
+  case Intrinsic::fptoui:
+    Opcode = ISD::STRICT_FP_TO_UINT;
+    break;
+  case Intrinsic::fptosi:
+    Opcode = ISD::STRICT_FP_TO_SINT;
+    break;
+  case Intrinsic::uitofp:
+    Opcode = ISD::STRICT_UINT_TO_FP;
+    break;
+  case Intrinsic::sitofp:
+    Opcode = ISD::STRICT_SINT_TO_FP;
+    break;
+  case Intrinsic::fptrunc:
+    Opcode = ISD::STRICT_FP_ROUND;
+    break;
+  case Intrinsic::fpext:
+    Opcode = ISD::STRICT_FP_EXTEND;
+    break;
+  case Intrinsic::fcmp:
+    Opcode = ISD::STRICT_FSETCC;
+    break;
+  case Intrinsic::fcmps:
+    Opcode = ISD::STRICT_FSETCCS;
+    break;
   default:
-    llvm_unreachable("Unhandled FP intrinsic in visitBundledFPIntrinsicAsStrict");
+    llvm_unreachable(
+        "Unhandled FP intrinsic in visitBundledFPIntrinsicAsStrict");
   }
 
   // Additional operands for specific opcodes.
@@ -8790,7 +8824,6 @@ void SelectionDAGBuilder::visitBundledFPIntrinsicAsStrict(
   setValue(&I, Result.getValue(0));
 }
 
-
 static unsigned getISDForVPIntrinsic(const VPIntrinsic &VPIntrin) {
   std::optional<unsigned> ResOPC;
   switch (VPIntrin.getIntrinsicID()) {
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 191511a9f..7a51b2b53 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1206,57 +1206,25 @@ void TargetLoweringBase::initActions() {
                           ISD::LRINT, ISD::LLRINT, ISD::LROUND, ISD::LLROUND},
                          VT, Expand);
 
-            // Constrained floating-point operations default to expand.
-      setOperationAction({
-          ISD::STRICT_FADD,
-          ISD::STRICT_FSUB,
-          ISD::STRICT_FMUL,
-          ISD::STRICT_FDIV,
-          ISD::STRICT_FREM,
-          ISD::STRICT_FP_EXTEND,
-          ISD::STRICT_SINT_TO_FP,
-          ISD::STRICT_UINT_TO_FP,
-          ISD::STRICT_FP_TO_SINT,
-          ISD::STRICT_FP_TO_UINT,
-          ISD::STRICT_FP_ROUND,
-          ISD::STRICT_FSETCC,
-          ISD::STRICT_FSETCCS,
-          ISD::STRICT_FACOS,
-          ISD::STRICT_FASIN,
-          ISD::STRICT_FATAN,
-          ISD::STRICT_FATAN2,
-          ISD::STRICT_FCEIL,
-          ISD::STRICT_FCOS,
-          ISD::STRICT_FCOSH,
-          ISD::STRICT_FEXP,
-          ISD::STRICT_FEXP2,
-          ISD::STRICT_FFLOOR,
-          ISD::STRICT_FMA,
-          ISD::STRICT_FLOG,
-          ISD::STRICT_FLOG10,
-          ISD::STRICT_FLOG2,
-          ISD::STRICT_LRINT,
-          ISD::STRICT_LLRINT,
-          ISD::STRICT_LROUND,
-          ISD::STRICT_LLROUND,
-          ISD::STRICT_FMAXNUM,
-          ISD::STRICT_FMINNUM,
-          ISD::STRICT_FMAXIMUM,
-          ISD::STRICT_FMINIMUM,
-          ISD::STRICT_FNEARBYINT,
-          ISD::STRICT_FPOW,
-          ISD::STRICT_FPOWI,
-          ISD::STRICT_FLDEXP,
-          ISD::STRICT_FRINT,
-          ISD::STRICT_FROUND,
-          ISD::STRICT_FROUNDEVEN,
-          ISD::STRICT_FSIN,
-          ISD::STRICT_FSINH,
-          ISD::STRICT_FSQRT,
-          ISD::STRICT_FTAN,
-          ISD::STRICT_FTANH,
-          ISD::STRICT_FTRUNC
-      }, VT, Expand);
+    // Constrained floating-point operations default to expand.
+    setOperationAction(
+        {ISD::STRICT_FADD,       ISD::STRICT_FSUB,       ISD::STRICT_FMUL,
+         ISD::STRICT_FDIV,       ISD::STRICT_FREM,       ISD::STRICT_FP_EXTEND,
+         ISD::STRICT_SINT_TO_FP, ISD::STRICT_UINT_TO_FP, ISD::STRICT_FP_TO_SINT,
+         ISD::STRICT_FP_TO_UINT, ISD::STRICT_FP_ROUND,   ISD::STRICT_FSETCC,
+         ISD::STRICT_FSETCCS,    ISD::STRICT_FACOS,      ISD::STRICT_FASIN,
+         ISD::STRICT_FATAN,      ISD::STRICT_FATAN2,     ISD::STRICT_FCEIL,
+         ISD::STRICT_FCOS,       ISD::STRICT_FCOSH,      ISD::STRICT_FEXP,
+         ISD::STRICT_FEXP2,      ISD::STRICT_FFLOOR,     ISD::STRICT_FMA,
+         ISD::STRICT_FLOG,       ISD::STRICT_FLOG10,     ISD::STRICT_FLOG2,
+         ISD::STRICT_LRINT,      ISD::STRICT_LLRINT,     ISD::STRICT_LROUND,
+         ISD::STRICT_LLROUND,    ISD::STRICT_FMAXNUM,    ISD::STRICT_FMINNUM,
+         ISD::STRICT_FMAXIMUM,   ISD::STRICT_FMINIMUM,   ISD::STRICT_FNEARBYINT,
+         ISD::STRICT_FPOW,       ISD::STRICT_FPOWI,      ISD::STRICT_FLDEXP,
+         ISD::STRICT_FRINT,      ISD::STRICT_FROUND,     ISD::STRICT_FROUNDEVEN,
+         ISD::STRICT_FSIN,       ISD::STRICT_FSINH,      ISD::STRICT_FSQRT,
+         ISD::STRICT_FTAN,       ISD::STRICT_FTANH,      ISD::STRICT_FTRUNC},
+        VT, Expand);
 
     // For most targets @llvm.get.dynamic.area.offset just returns 0.
     setOperationAction(ISD::GET_DYNAMIC_AREA_OFFSET, VT, Expand);
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 483b12381..2122b2a79 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -4967,53 +4967,53 @@ static Value *upgradeVectorSplice(CallBase *CI, IRBuilder<> &Builder) {
 /// new FP intrinsic ID (llvm.fadd, llvm.sqrt, etc.).
 static Intrinsic::ID getNewFPIntrinsicForConstrainedName(StringRef OpName) {
   return StringSwitch<Intrinsic::ID>(OpName)
-      .Case("fadd",    Intrinsic::fadd)
-      .Case("fsub",    Intrinsic::fsub)
-      .Case("fmul",    Intrinsic::fmul)
-      .Case("fdiv",    Intrinsic::fdiv)
-      .Case("frem",    Intrinsic::frem)
-      .Case("fma",     Intrinsic::fma)
+      .Case("fadd", Intrinsic::fadd)
+      .Case("fsub", Intrinsic::fsub)
+      .Case("fmul", Intrinsic::fmul)
+      .Case("fdiv", Intrinsic::fdiv)
+      .Case("frem", Intrinsic::frem)
+      .Case("fma", Intrinsic::fma)
       .Case("fmuladd", Intrinsic::fmuladd)
-      .Case("fcmp",    Intrinsic::fcmp)
-      .Case("fcmps",   Intrinsic::fcmps)
-      .Case("fptoui",  Intrinsic::fptoui)
-      .Case("fptosi",  Intrinsic::fptosi)
-      .Case("uitofp",  Intrinsic::uitofp)
-      .Case("sitofp",  Intrinsic::sitofp)
+      .Case("fcmp", Intrinsic::fcmp)
+      .Case("fcmps", Intrinsic::fcmps)
+      .Case("fptoui", Intrinsic::fptoui)
+      .Case("fptosi", Intrinsic::fptosi)
+      .Case("uitofp", Intrinsic::uitofp)
+      .Case("sitofp", Intrinsic::sitofp)
       .Case("fptrunc", Intrinsic::fptrunc)
-      .Case("fpext",   Intrinsic::fpext)
-      .Case("sqrt",    Intrinsic::sqrt)
-      .Case("powi",    Intrinsic::powi)
-      .Case("ldexp",   Intrinsic::ldexp)
-      .Case("sin",     Intrinsic::sin)
-      .Case("asin",    Intrinsic::asin)
-      .Case("cos",     Intrinsic::cos)
-      .Case("acos",    Intrinsic::acos)
-      .Case("tan",     Intrinsic::tan)
-      .Case("atan",    Intrinsic::atan)
-      .Case("atan2",   Intrinsic::atan2)
-      .Case("sinh",    Intrinsic::sinh)
-      .Case("cosh",    Intrinsic::cosh)
-      .Case("tanh",    Intrinsic::tanh)
-      .Case("pow",     Intrinsic::pow)
-      .Case("log",     Intrinsic::log)
-      .Case("log10",   Intrinsic::log10)
-      .Case("log2",    Intrinsic::log2)
-      .Case("exp",     Intrinsic::exp)
-      .Case("exp2",    Intrinsic::exp2)
-      .Case("rint",    Intrinsic::rint)
+      .Case("fpext", Intrinsic::fpext)
+      .Case("sqrt", Intrinsic::sqrt)
+      .Case("powi", Intrinsic::powi)
+      .Case("ldexp", Intrinsic::ldexp)
+      .Case("sin", Intrinsic::sin)
+      .Case("asin", Intrinsic::asin)
+      .Case("cos", Intrinsic::cos)
+      .Case("acos", Intrinsic::acos)
+      .Case("tan", Intrinsic::tan)
+      .Case("atan", Intrinsic::atan)
+      .Case("atan2", Intrinsic::atan2)
+      .Case("sinh", Intrinsic::sinh)
+      .Case("cosh", Intrinsic::cosh)
+      .Case("tanh", Intrinsic::tanh)
+      .Case("pow", Intrinsic::pow)
+      .Case("log", Intrinsic::log)
+      .Case("log10", Intrinsic::log10)
+      .Case("log2", Intrinsic::log2)
+      .Case("exp", Intrinsic::exp)
+      .Case("exp2", Intrinsic::exp2)
+      .Case("rint", Intrinsic::rint)
       .Case("nearbyint", Intrinsic::nearbyint)
-      .Case("lrint",   Intrinsic::lrint)
-      .Case("llrint",  Intrinsic::llrint)
-      .Case("ceil",    Intrinsic::ceil)
-      .Case("floor",   Intrinsic::floor)
-      .Case("round",   Intrinsic::round)
+      .Case("lrint", Intrinsic::lrint)
+      .Case("llrint", Intrinsic::llrint)
+      .Case("ceil", Intrinsic::ceil)
+      .Case("floor", Intrinsic::floor)
+      .Case("round", Intrinsic::round)
       .Case("roundeven", Intrinsic::roundeven)
-      .Case("trunc",   Intrinsic::trunc)
-      .Case("lround",  Intrinsic::lround)
+      .Case("trunc", Intrinsic::trunc)
+      .Case("lround", Intrinsic::lround)
       .Case("llround", Intrinsic::llround)
-      .Case("minnum",  Intrinsic::minnum)
-      .Case("maxnum",  Intrinsic::maxnum)
+      .Case("minnum", Intrinsic::minnum)
+      .Case("maxnum", Intrinsic::maxnum)
       .Case("minimum", Intrinsic::minimum)
       .Case("maximum", Intrinsic::maximum)
       .Default(Intrinsic::not_intrinsic);
@@ -5068,18 +5068,19 @@ static Value *upgradeConstrainedFPIntrinsicCall(CallBase *CI, StringRef Name,
   // fpext, fptosi, fptoui, fcmp, fcmps, ceil, floor, trunc, round, roundeven,
   // lround, llround, maxnum, minnum, maximum, minimum
   bool HasRM = !StringSwitch<bool>(OpName)
-      .Cases({"fpext", "fptosi", "fptoui"}, true)
-      .Cases({"fcmp", "fcmps"}, true)
-      .Cases({"ceil", "floor", "trunc"}, true)
-      .Cases({"round", "roundeven"}, true)
-      .Cases({"lround", "llround"}, true)
-      .Cases({"maxnum", "minnum", "maximum", "minimum"}, true)
-      .Default(false);
+                    .Cases({"fpext", "fptosi", "fptoui"}, true)
+                    .Cases({"fcmp", "fcmps"}, true)
+                    .Cases({"ceil", "floor", "trunc"}, true)
+                    .Cases({"round", "roundeven"}, true)
+                    .Cases({"lround", "llround"}, true)
+                    .Cases({"maxnum", "minnum", "maximum", "minimum"}, true)
+                    .Default(false);
 
   // Parse rounding mode (second-to-last arg when present).
   std::optional<RoundingMode> RM;
   if (HasRM) {
-    StringRef RMS = getConstrainedFPMetaStr(CI->getArgOperand(CI->arg_size() - 2));
+    StringRef RMS =
+        getConstrainedFPMetaStr(CI->getArgOperand(CI->arg_size() - 2));
     if (RMS.empty())
       return nullptr; // malformed
     RM = convertStrToRoundingMode(RMS);
@@ -5088,7 +5089,8 @@ static Value *upgradeConstrainedFPIntrinsicCall(CallBase *CI, StringRef Name,
   }
 
   // Parse exception behavior (always the last metadata arg).
-  StringRef EBS = getConstrainedFPMetaStr(CI->getArgOperand(CI->arg_size() - 1));
+  StringRef EBS =
+      getConstrainedFPMetaStr(CI->getArgOperand(CI->arg_size() - 1));
   if (EBS.empty())
     return nullptr; // malformed
   std::optional<fp::ExceptionBehavior> EB = convertStrToExceptionBehavior(EBS);
@@ -5100,7 +5102,7 @@ static Value *upgradeConstrainedFPIntrinsicCall(CallBase *CI, StringRef Name,
 
   // Collect the non-metadata value args.
   // Layout: [value args...] [predicate?] [rounding mode?] [exception behavior]
-  bool IsFCmp  = (OpName == "fcmp");
+  bool IsFCmp = (OpName == "fcmp");
   bool IsFCmps = (OpName == "fcmps");
   bool IsCompare = IsFCmp || IsFCmps;
   unsigned NArgs = CI->arg_size() - 1; // always has EB
diff --git a/llvm/lib/IR/FPEnv.cpp b/llvm/lib/IR/FPEnv.cpp
index 433f5d7f3..e2e24d960 100644
--- a/llvm/lib/IR/FPEnv.cpp
+++ b/llvm/lib/IR/FPEnv.cpp
@@ -32,7 +32,8 @@ llvm::convertStrToRoundingMode(StringRef RoundingArg) {
       .Default(std::nullopt);
 }
 
-std::optional<RoundingMode> llvm::convertBundleToRoundingMode(StringRef RoundingArg) {
+std::optional<RoundingMode>
+llvm::convertBundleToRoundingMode(StringRef RoundingArg) {
   return StringSwitch<std::optional<RoundingMode>>(RoundingArg)
       .Case("dyn", RoundingMode::Dynamic)
       .Case("rte", RoundingMode::NearestTiesToEven)
@@ -71,7 +72,8 @@ llvm::convertRoundingModeToStr(RoundingMode UseRounding) {
   return RoundingStr;
 }
 
-std::optional<StringRef> llvm::convertRoundingModeToBundle(RoundingMode UseRounding) {
+std::optional<StringRef>
+llvm::convertRoundingModeToBundle(RoundingMode UseRounding) {
   std::optional<StringRef> RoundingStr;
   switch (UseRounding) {
   case RoundingMode::Dynamic:
@@ -149,4 +151,3 @@ llvm::convertExceptionBehaviorToBundle(fp::ExceptionBehavior UseExcept) {
   }
   return ExceptStr;
 }
-
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 7b04bed84..cfde91969 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -613,12 +613,11 @@ bool CallBase::hasReadingOperandBundles() const {
   // Implementation note: this is a conservative implementation of operand
   // bundle semantics, where *any* non-assume operand bundle (other than
   // ptrauth) forces a callsite to be at least readonly.
-  return hasOperandBundlesOtherThan({LLVMContext::OB_ptrauth,
-                                     LLVMContext::OB_kcfi,
-                                     LLVMContext::OB_fp_control,
-                                     LLVMContext::OB_fp_except,
-                                     LLVMContext::OB_convergencectrl,
-                                     LLVMContext::OB_deactivation_symbol}) &&
+  return hasOperandBundlesOtherThan(
+             {LLVMContext::OB_ptrauth, LLVMContext::OB_kcfi,
+              LLVMContext::OB_fp_control, LLVMContext::OB_fp_except,
+              LLVMContext::OB_convergencectrl,
+              LLVMContext::OB_deactivation_symbol}) &&
          getIntrinsicID() != Intrinsic::assume;
 }
 
@@ -896,7 +895,7 @@ bool CallBase::hasArgumentWithAdditionalReturnCaptureComponents() const {
 }
 
 std::optional<StringRef> llvm::getBundleOperandByPrefix(OperandBundleUse Bundle,
-                                                      StringRef Prefix) {
+                                                        StringRef Prefix) {
   for (const auto &Item : Bundle.Inputs) {
     Metadata *MD = cast<MetadataAsValue>(Item.get())->getMetadata();
     if (const auto *MDS = dyn_cast<MDString>(MD)) {
@@ -909,9 +908,9 @@ std::optional<StringRef> llvm::getBundleOperandByPrefix(OperandBundleUse Bundle,
 }
 
 void llvm::addOperandToBundleTag(LLVMContext &Ctx,
-                               SmallVectorImpl<OperandBundleDef> &Bundles,
-                               StringRef Tag, size_t PrefixSize,
-                               StringRef Val) {
+                                 SmallVectorImpl<OperandBundleDef> &Bundles,
+                                 StringRef Tag, size_t PrefixSize,
+                                 StringRef Val) {
   assert(PrefixSize > 0 && "Unexpected prefix size");
   assert(PrefixSize < Val.size() && "Invalid prefix size");
   StringRef Prefix = Val.take_front(PrefixSize);
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 446da39d6..89b50d175 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -285,7 +285,6 @@ void InstrProfCallsite::setCallee(Value *Callee) {
   setArgOperand(4, Callee);
 }
 
-
 static FCmpInst::Predicate getFPPredicateFromMD(const Value *Op) {
   Metadata *MD = cast<MetadataAsValue>(Op)->getMetadata();
   if (!MD || !isa<MDString>(MD))
@@ -308,7 +307,6 @@ static FCmpInst::Predicate getFPPredicateFromMD(const Value *Op) {
       .Default(FCmpInst::BAD_FCMP_PREDICATE);
 }
 
-
 ElementCount VPIntrinsic::getStaticVectorLength() const {
   auto GetVectorLengthOfType = [](const Type *T) -> ElementCount {
     const auto *VT = cast<VectorType>(T);
@@ -500,7 +498,6 @@ constexpr static bool doesVPHaveNoFunctionalEquivalent(Intrinsic::ID ID) {
                 getFunctionalIntrinsicIDForVP(Intrinsic::VPID));
 #include "llvm/IR/VPIntrinsics.def"
 
-
 Intrinsic::ID VPIntrinsic::getForOpcode(unsigned IROPC) {
   switch (IROPC) {
   default:
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 3492cdad0..61b729636 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -49,10 +49,10 @@
 
 #include "llvm/IR/Verifier.h"
 #include "llvm/ADT/APFloat.h"
-#include "llvm/ADT/FloatingPointMode.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/FloatingPointMode.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -78,8 +78,8 @@
 #include "llvm/IR/DebugInfo.h"
 #include "llvm/IR/DebugInfoMetadata.h"
 #include "llvm/IR/DebugLoc.h"
-#include "llvm/IR/DiagnosticInfo.h"
 #include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/DiagnosticInfo.h"
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/EHPersonalities.h"
 #include "llvm/IR/FPEnv.h"
diff --git a/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp b/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
index 5bd70b52e..95ee680e6 100644
--- a/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
@@ -1679,8 +1679,7 @@ Instruction *SPIRVEmitIntrinsics::visitCallInst(CallInst &Call) {
 }
 
 // Use a tip about rounding mode to create a decoration.
-void SPIRVEmitIntrinsics::useRoundingMode(IntrinsicInst *FPI,
-                                          IRBuilder<> &B) {
+void SPIRVEmitIntrinsics::useRoundingMode(IntrinsicInst *FPI, IRBuilder<> &B) {
   RoundingMode RM = FPI->getRoundingMode();
   unsigned RoundingModeDeco = std::numeric_limits<unsigned>::max();
   switch (RM) {
diff --git a/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp b/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp
index 7d7e35a1f..921a3c170 100644
--- a/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp
@@ -453,9 +453,8 @@ lowerNewFPBinopForSPIRV(CallInst *CI, Instruction::BinaryOps PlainOpc,
 // bundle carries a non-dynamic rounding mode (checked by the caller). We expand
 // to fmul + fadd and attach FPRoundingMode decorations to both instructions so
 // the rounding mode is preserved in the SPIRV output.
-static void
-lowerNewFmuladd(CallInst *CI,
-                SmallVector<Instruction *> &EraseFromParent) {
+static void lowerNewFmuladd(CallInst *CI,
+                            SmallVector<Instruction *> &EraseFromParent) {
   IRBuilder<> Builder(CI->getParent());
   Builder.SetInsertPoint(CI);
   Value *A = CI->getArgOperand(0);
@@ -472,7 +471,6 @@ lowerNewFmuladd(CallInst *CI,
   EraseFromParent.push_back(CI);
 }
 
-
 // Substitutes calls to LLVM intrinsics with either calls to SPIR-V intrinsics
 // or calls to proper generated functions. Returns True if F was modified.
 bool SPIRVPrepareFunctions::substituteIntrinsicCalls(Function *F) {
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 574485a5c..bdc995646 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -2011,7 +2011,8 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
   // prevents it from being removed. In some cases however the side effect is
   // actually absent. To detect this case, call SimplifyConstrainedFPCall. If it
   // returns a replacement, the call may be removed.
-  if (CI.use_empty() && Intrinsic::isConstrainedFPIntrinsic(CI.getIntrinsicID())) {
+  if (CI.use_empty() &&
+      Intrinsic::isConstrainedFPIntrinsic(CI.getIntrinsicID())) {
     if (simplifyConstrainedFPCall(&CI, SQ.getWithInstruction(&CI)))
       return eraseInstFromFunction(CI);
   }
diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp
index 22404c17d..675226f9b 100644
--- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp
+++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp
@@ -136,7 +136,8 @@ struct SimpleValue {
           // ebStrict means exceptions matter; don't CSE.
           if (CI->getExceptionBehavior() == fp::ebStrict)
             return false;
-          // Dynamic rounding mode means result depends on runtime mode; don't CSE.
+          // Dynamic rounding mode means result depends on runtime mode; don't
+          // CSE.
           if (CI->getRoundingMode() == RoundingMode::Dynamic)
             return false;
           return true;
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 47be4fe89..3d3609599 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -944,10 +944,12 @@ void llvm::CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc,
 /// constant arguments cause a significant amount of code in the callee to be
 /// dead.  Since this doesn't produce an exact copy of the input, it can't be
 /// used for things like CloneFunction or CloneModule.
-void llvm::CloneAndPruneFunctionInto(
-    Function *NewFunc, const Function *OldFunc, ValueToValueMapTy &VMap,
-    bool ModuleLevelChanges, SmallVectorImpl<ReturnInst *> &Returns,
-    const char *NameSuffix, ClonedCodeInfo *CodeInfo) {
+void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
+                                     ValueToValueMapTy &VMap,
+                                     bool ModuleLevelChanges,
+                                     SmallVectorImpl<ReturnInst *> &Returns,
+                                     const char *NameSuffix,
+                                     ClonedCodeInfo *CodeInfo) {
   CloneAndPruneIntoFromInst(NewFunc, OldFunc, &OldFunc->front().front(), VMap,
                             ModuleLevelChanges, Returns, NameSuffix, CodeInfo);
 }
diff --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp
index eb9d4310a..51eb59db9 100644
--- a/llvm/unittests/IR/IRBuilderTest.cpp
+++ b/llvm/unittests/IR/IRBuilderTest.cpp
@@ -649,9 +649,8 @@ TEST_F(IRBuilderTest, FPBundlesStrict) {
   {
     Function *Fn = Intrinsic::getOrInsertDeclaration(M.get(), Intrinsic::abs,
                                                      {Type::getInt64Ty(Ctx)});
-    GlobalVariable *GVInt = new GlobalVariable(*M, Type::getInt64Ty(Ctx), true,
-                                               GlobalValue::ExternalLinkage,
-                                               nullptr);
+    GlobalVariable *GVInt = new GlobalVariable(
+        *M, Type::getInt64Ty(Ctx), true, GlobalValue::ExternalLinkage, nullptr);
     Value *IntArg = Builder.CreateLoad(Type::getInt64Ty(Ctx), GVInt);
     Value *V = Builder.CreateCall(Fn, {IntArg, Builder.getInt1(false)});
     auto *I = cast<IntrinsicInst>(V);
diff --git a/llvm/unittests/IR/InstructionsTest.cpp b/llvm/unittests/IR/InstructionsTest.cpp
index 420808935..44e4a1772 100644
--- a/llvm/unittests/IR/InstructionsTest.cpp
+++ b/llvm/unittests/IR/InstructionsTest.cpp
@@ -565,7 +565,6 @@ TEST(InstructionsTest, FPMathOperator) {
   I->deleteValue();
 }
 
-
 TEST(InstructionsTest, isEliminableCastPair) {
   LLVMContext C;
   DataLayout DL1("p1:32:32-p2:64:64:64:32");

``````````

</details>


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


More information about the llvm-commits mailing list