[llvm] [profcheck] Fix profile metadata in IntegerDivision/ExpandIRinsts (PR #173114)

Jin Huang via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 8 12:55:40 PST 2026


https://github.com/jinhuang1102 updated https://github.com/llvm/llvm-project/pull/173114

>From 52a7b279f9a198776705c374c316646ff60db0bc Mon Sep 17 00:00:00 2001
From: Jin Huang <jingold at google.com>
Date: Fri, 19 Dec 2025 22:49:22 +0000
Subject: [PATCH] [profcheck] Fix profile metadata missing in ExpandLargeDivRem

---
 llvm/lib/CodeGen/ExpandIRInsts.cpp            | 104 ++++++++++++++++-
 llvm/lib/Transforms/Utils/IntegerDivision.cpp |  73 +++++++++++-
 .../X86/expand-large-fp-convert-fptosi129.ll  |  64 ++++++-----
 .../X86/expand-large-fp-convert-fptoui129.ll  |  64 ++++++-----
 .../X86/expand-large-fp-convert-si129tofp.ll  |  69 +++++++-----
 .../X86/expand-large-fp-convert-ui129tofp.ll  |  69 +++++++-----
 .../Transforms/ExpandIRInsts/X86/sdiv129.ll   |  19 ++--
 .../Transforms/ExpandIRInsts/X86/srem129.ll   |  25 +++--
 .../Transforms/ExpandIRInsts/X86/udiv129.ll   |  19 ++--
 .../Transforms/ExpandIRInsts/X86/urem129.ll   |  19 ++--
 .../Transforms/ExpandIRInsts/X86/vector.ll    | 106 +++++++++---------
 llvm/utils/profcheck-xfail.txt                |  10 +-
 12 files changed, 428 insertions(+), 213 deletions(-)

diff --git a/llvm/lib/CodeGen/ExpandIRInsts.cpp b/llvm/lib/CodeGen/ExpandIRInsts.cpp
index 1d09000fbca6b..e2454a23f54d8 100644
--- a/llvm/lib/CodeGen/ExpandIRInsts.cpp
+++ b/llvm/lib/CodeGen/ExpandIRInsts.cpp
@@ -40,10 +40,14 @@
 #include "llvm/CodeGen/TargetSubtargetInfo.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/InstIterator.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/IR/MDBuilder.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/IR/ProfDataUtils.h"
 #include "llvm/InitializePasses.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Target/TargetMachine.h"
@@ -56,6 +60,10 @@
 
 using namespace llvm;
 
+namespace llvm {
+extern cl::opt<bool> ProfcheckDisableMetadataFixes;
+}
+
 static cl::opt<unsigned>
     ExpandFpConvertBits("expand-fp-convert-bits", cl::Hidden,
                         cl::init(llvm::IntegerType::MAX_INT_BITS),
@@ -569,38 +577,84 @@ static void expandFPToI(Instruction *FPToI) {
   Value *ARep = Builder.CreateZExt(ARep0, FPToI->getType());
   Value *PosOrNeg = Builder.CreateICmpSGT(
       ARep0, ConstantInt::getSigned(Builder.getIntNTy(FloatWidth), -1));
+  // Assume the sign is likely positive, although mathematically it's 50-50.
   Value *Sign = Builder.CreateSelect(PosOrNeg, ConstantInt::getSigned(IntTy, 1),
                                      ConstantInt::getSigned(IntTy, -1));
+  if (!ProfcheckDisableMetadataFixes) {
+    if (Instruction *SignInst = dyn_cast<Instruction>(Sign)) {
+      SignInst->setMetadata(
+          LLVMContext::MD_prof,
+          MDBuilder(SignInst->getContext()).createLikelyBranchWeights());
+    }
+  }
   Value *And =
       Builder.CreateLShr(ARep, Builder.getIntN(BitWidth, FPMantissaWidth));
   Value *And2 = Builder.CreateAnd(
       And, Builder.getIntN(BitWidth, (1 << ExponentWidth) - 1));
   Value *Abs = Builder.CreateAnd(ARep, SignificandMask);
   Value *Or = Builder.CreateOr(Abs, ImplicitBit);
+  // The comparison checks if the true exponent is negative (i.e., And2 <
+  // ExponentBias). We assume this case is less common, so the branch to 'End'
+  // is the unlikely path.
   Value *Cmp =
       Builder.CreateICmpULT(And2, Builder.getIntN(BitWidth, ExponentBias));
-  Builder.CreateCondBr(Cmp, End, IfEnd);
+  Value *CondBrEntry = Builder.CreateCondBr(Cmp, End, IfEnd);
+  if (!ProfcheckDisableMetadataFixes) {
+    if (Instruction *CondBrEntryInst = dyn_cast<Instruction>(CondBrEntry)) {
+      CondBrEntryInst->setMetadata(LLVMContext::MD_prof,
+                                   MDBuilder(CondBrEntryInst->getContext())
+                                       .createUnlikelyBranchWeights());
+    }
+  }
 
   // if.end:
   Builder.SetInsertPoint(IfEnd);
   Value *Add1 = Builder.CreateAdd(
       And2, ConstantInt::getSigned(
                 IntTy, -static_cast<int64_t>(ExponentBias + BitWidth)));
+  // The comparison is doing the overflow check so we assume the 'true' path is
+  // unlikely.
   Value *Cmp3 = Builder.CreateICmpULT(
       Add1, ConstantInt::getSigned(IntTy, -static_cast<int64_t>(BitWidth)));
-  Builder.CreateCondBr(Cmp3, IfThen5, IfEnd9);
+  Value *CondBrIfEnd = Builder.CreateCondBr(Cmp3, IfThen5, IfEnd9);
+  if (!ProfcheckDisableMetadataFixes) {
+    if (Instruction *CondBrIfEndInst = dyn_cast<Instruction>(CondBrIfEnd)) {
+      CondBrIfEndInst->setMetadata(LLVMContext::MD_prof,
+                                   MDBuilder(CondBrIfEndInst->getContext())
+                                       .createUnlikelyBranchWeights());
+    }
+  }
 
   // if.then5:
   Builder.SetInsertPoint(IfThen5);
   Value *PosInf = Builder.CreateXor(NegOne, NegInf);
   Value *Cond8 = Builder.CreateSelect(PosOrNeg, PosInf, NegInf);
+  if (!ProfcheckDisableMetadataFixes) {
+    if (Instruction *Cond8Inst = dyn_cast<Instruction>(Cond8)) {
+      setExplicitlyUnknownBranchWeightsIfProfiled(*Cond8Inst, DEBUG_TYPE,
+                                                  FPToI->getFunction());
+    }
+  }
   Builder.CreateBr(End);
 
   // if.end9:
   Builder.SetInsertPoint(IfEnd9);
+  // This branch determines whether the significand needs to be shifted left
+  // or right to form the integer part. In many real-world scenarios,
+  // floating-point numbers are relatively small, meaning their effective
+  // exponent is less than the mantissa width, requiring a right shift to form
+  // the integer part. Therefore, the 'true' path (right shift) is assumed to
+  // be more likely.
   Value *Cmp10 = Builder.CreateICmpULT(
       And2, Builder.getIntN(BitWidth, ExponentBias + FPMantissaWidth));
-  Builder.CreateCondBr(Cmp10, IfThen12, IfElse);
+  Value *CondBrIfEnd9 = Builder.CreateCondBr(Cmp10, IfThen12, IfElse);
+  if (!ProfcheckDisableMetadataFixes) {
+    if (Instruction *CondBrIfEnd9Inst = dyn_cast<Instruction>(CondBrIfEnd9)) {
+      CondBrIfEnd9Inst->setMetadata(LLVMContext::MD_prof,
+                                    MDBuilder(CondBrIfEnd9Inst->getContext())
+                                        .createLikelyBranchWeights());
+    }
+  }
 
   // if.then12:
   Builder.SetInsertPoint(IfThen12);
@@ -772,8 +826,17 @@ static void expandIToFP(Instruction *IToFP) {
 
   // entry:
   Builder.SetInsertPoint(Entry);
+  // We assume that the zero is an unlikely input case, so the branch to 'End'
+  // is the unlikely path.
   Value *Cmp = Builder.CreateICmpEQ(IntVal, ConstantInt::getSigned(IntTy, 0));
-  Builder.CreateCondBr(Cmp, End, IfEnd);
+  Value *CondBrEntry = Builder.CreateCondBr(Cmp, End, IfEnd);
+  if (!ProfcheckDisableMetadataFixes) {
+    if (Instruction *CondBrEntryInst = dyn_cast<Instruction>(CondBrEntry)) {
+      CondBrEntryInst->setMetadata(
+          LLVMContext::MD_prof,
+          MDBuilder(CondBrEntryInst->getContext()).createLikelyBranchWeights());
+    }
+  }
 
   // if.end:
   Builder.SetInsertPoint(IfEnd);
@@ -790,13 +853,32 @@ static void expandIToFP(Instruction *IToFP) {
                                   FloatWidth == 128 ? Call : Cast);
   Value *Cmp3 = Builder.CreateICmpSGT(
       Sub1, Builder.getIntN(BitWidthNew, FPMantissaWidth + 1));
-  Builder.CreateCondBr(Cmp3, IfThen4, IfElse);
+  // We assume the case where the input exceeds Mantissa width and proceed
+  // to rounding logic is more likely than the case where the input fits
+  // fits perfectly within the Mantissa width.
+  Value *CondBrIfEnd = Builder.CreateCondBr(Cmp3, IfThen4, IfElse);
+  if (!ProfcheckDisableMetadataFixes) {
+    if (Instruction *CondBrIfEndInst = dyn_cast<Instruction>(CondBrIfEnd)) {
+      CondBrIfEndInst->setMetadata(
+          LLVMContext::MD_prof,
+          MDBuilder(CondBrIfEndInst->getContext()).createLikelyBranchWeights());
+    }
+  }
 
   // if.then4:
   Builder.SetInsertPoint(IfThen4);
   llvm::SwitchInst *SI = Builder.CreateSwitch(Sub1, SwDefault);
   SI->addCase(Builder.getIntN(BitWidthNew, FPMantissaWidth + 2), SwBB);
   SI->addCase(Builder.getIntN(BitWidthNew, FPMantissaWidth + 3), SwEpilog);
+  // Add branch weights to the SwitchInst. The weights are provided for the
+  // default case first (SwDefault), followed by each explicit case in the
+  // order they were added (SwBB, then SwEpilog). Because the following cases
+  // are rare, the defalut case is given a likely weight.
+  if (!ProfcheckDisableMetadataFixes) {
+    SI->setMetadata(LLVMContext::MD_prof,
+                    MDBuilder(SI->getContext())
+                        .createBranchWeights({(1U << 20) - 1, 1, 1}));
+  }
 
   // sw.bb:
   Builder.SetInsertPoint(SwBB);
@@ -850,7 +932,17 @@ static void expandIToFP(Instruction *IToFP) {
     ExtractT64 = Builder.CreateTrunc(Sub2, Builder.getInt64Ty());
   else
     ExtractT64 = Builder.CreateTrunc(Extract63, Builder.getInt32Ty());
-  Builder.CreateCondBr(PosOrNeg, IfEnd26, IfThen20);
+  // Rounding usually keeps the exponent within its current magnitude and
+  // overflow is rare. The False path is unlikely to be taken.
+  Value *CondBrSwEpilog = Builder.CreateCondBr(PosOrNeg, IfEnd26, IfThen20);
+  if (!ProfcheckDisableMetadataFixes) {
+    if (Instruction *CondBrSwEpilogInst =
+            dyn_cast<Instruction>(CondBrSwEpilog)) {
+      CondBrSwEpilogInst->setMetadata(
+          LLVMContext::MD_prof, MDBuilder(CondBrSwEpilogInst->getContext())
+                                    .createLikelyBranchWeights());
+    }
+  }
 
   // if.then20
   Builder.SetInsertPoint(IfThen20);
diff --git a/llvm/lib/Transforms/Utils/IntegerDivision.cpp b/llvm/lib/Transforms/Utils/IntegerDivision.cpp
index e95a7a9ae525a..d3ab3e348bf42 100644
--- a/llvm/lib/Transforms/Utils/IntegerDivision.cpp
+++ b/llvm/lib/Transforms/Utils/IntegerDivision.cpp
@@ -16,13 +16,23 @@
 #include "llvm/Transforms/Utils/IntegerDivision.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/Instruction.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/MDBuilder.h"
+#include "llvm/IR/ProfDataUtils.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/CommandLine.h"
 
 using namespace llvm;
 
 #define DEBUG_TYPE "integer-division"
 
+namespace llvm {
+extern cl::opt<bool> ProfcheckDisableMetadataFixes;
+}
+
 /// Generate code to compute the remainder of two signed integers. Returns the
 /// remainder, which will have the sign of the dividend. Builder's insert point
 /// should be pointing where the caller wants code generated, e.g. at the srem
@@ -235,11 +245,51 @@ static Value *generateUnsignedDivisionCode(Value *Dividend, Value *Divisor,
   Value *Tmp1 = Builder.CreateCall(CTLZ, {Dividend, True});
   Value *SR          = Builder.CreateSub(Tmp0, Tmp1);
   Value *Ret0_4      = Builder.CreateICmpUGT(SR, MSB);
+
+  // Add 'unlikely' branch weights. We mark the case where either the divisor
+  // or the dividend is equal to zero as unlikely.
   Value *Ret0        = Builder.CreateLogicalOr(Ret0_3, Ret0_4);
+  if (!ProfcheckDisableMetadataFixes) {
+    if (Instruction *Ret0SelectI = dyn_cast<Instruction>(Ret0)) {
+      Ret0SelectI->setMetadata(
+          LLVMContext::MD_prof,
+          MDBuilder(Ret0SelectI->getContext()).createUnlikelyBranchWeights());
+    }
+  }
   Value *RetDividend = Builder.CreateICmpEQ(SR, MSB);
+
+  // Add 'unlikely' branch weights. We mark the case where the divisor is
+  // greater than the dividend as unlikely.
   Value *RetVal      = Builder.CreateSelect(Ret0, Zero, Dividend);
+  if (!ProfcheckDisableMetadataFixes) {
+    if (Instruction *RetValSelectI = dyn_cast<Instruction>(RetVal)) {
+      RetValSelectI->setMetadata(
+          LLVMContext::MD_prof,
+          MDBuilder(RetValSelectI->getContext()).createUnlikelyBranchWeights());
+    }
+  }
+  // This select instruction (EarlyRet) is used to check another edge case, and
+  // it share the same branch weights as RetVal so we reuse the 'unlikely'
+  // weigthts here.
   Value *EarlyRet    = Builder.CreateLogicalOr(Ret0, RetDividend);
-  Builder.CreateCondBr(EarlyRet, End, BB1);
+  if (!ProfcheckDisableMetadataFixes) {
+    if (Instruction *EarlyRetSelectI = dyn_cast<Instruction>(EarlyRet)) {
+      EarlyRetSelectI->setMetadata(LLVMContext::MD_prof,
+                                   MDBuilder(EarlyRetSelectI->getContext())
+                                       .createUnlikelyBranchWeights());
+    }
+  }
+
+  // The condition of this branch is based on `EarlyRet`. `EarlyRet` is true
+  // only for special cases like dividend or divisor being zero, or the divisor
+  // being greater than the dividend. Thus, the branch to `End` is unlikely,
+  // and we expect to more frequently enter `BB1`.
+  Instruction *ConBrSpecialCases = Builder.CreateCondBr(EarlyRet, End, BB1);
+  if (!ProfcheckDisableMetadataFixes) {
+    ConBrSpecialCases->setMetadata(LLVMContext::MD_prof,
+                                   MDBuilder(ConBrSpecialCases->getContext())
+                                       .createUnlikelyBranchWeights());
+  }
 
   // ; bb1:                                             ; preds = %special-cases
   // ;   %sr_1     = add i32 %sr, 1
@@ -251,8 +301,17 @@ static Value *generateUnsignedDivisionCode(Value *Dividend, Value *Divisor,
   Value *SR_1     = Builder.CreateAdd(SR, One);
   Value *Tmp2     = Builder.CreateSub(MSB, SR);
   Value *Q        = Builder.CreateShl(Dividend, Tmp2);
+  // We assume that in the common case, the dividend's magnitude is larger than
+  // the divisor's magnitude such that the loop counter (SR) is non-zero.
+  // Specifically, if |dividend| >= 2 * |divisor|, then SR >= 1, ensuring SR_1
+  // >= 2. The case where SR_1 == 0 is thus considered unlikely.
   Value *SkipLoop = Builder.CreateICmpEQ(SR_1, Zero);
-  Builder.CreateCondBr(SkipLoop, LoopExit, Preheader);
+  Instruction *ConBrBB1 = Builder.CreateCondBr(SkipLoop, LoopExit, Preheader);
+  if (!ProfcheckDisableMetadataFixes) {
+    ConBrBB1->setMetadata(
+        LLVMContext::MD_prof,
+        MDBuilder(ConBrBB1->getContext()).createUnlikelyBranchWeights());
+  }
 
   // ; preheader:                                           ; preds = %bb1
   // ;   %tmp3 = lshr i32 %dividend, %sr_1
@@ -298,7 +357,15 @@ static Value *generateUnsignedDivisionCode(Value *Dividend, Value *Divisor,
   Value *R     = Builder.CreateSub(Tmp7, Tmp11);
   Value *SR_2  = Builder.CreateAdd(SR_3, NegOne);
   Value *Tmp12 = Builder.CreateICmpEQ(SR_2, Zero);
-  Builder.CreateCondBr(Tmp12, LoopExit, DoWhile);
+  // The loop implements the core bit-by-bit binary long division algorithm.
+  // The branch is unlikely to exit the loop early until it has processed all
+  // significant bits.
+  Instruction *ConBrDoWhile = Builder.CreateCondBr(Tmp12, LoopExit, DoWhile);
+  if (!ProfcheckDisableMetadataFixes) {
+    ConBrDoWhile->setMetadata(
+        LLVMContext::MD_prof,
+        MDBuilder(ConBrDoWhile->getContext()).createUnlikelyBranchWeights());
+  }
 
   // ; loop-exit:                                      ; preds = %do-while, %bb1
   // ;   %carry_2 = phi i32 [ 0, %bb1 ], [ %carry, %do-while ]
diff --git a/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptosi129.ll b/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptosi129.ll
index d3a77de057ef5..7413f6e8656e7 100644
--- a/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptosi129.ll
+++ b/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptosi129.ll
@@ -1,8 +1,8 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
 ; RUN: opt -S -mtriple=x86_64-- --expand-ir-insts < %s | FileCheck %s
 ; RUN: opt -S -mtriple=x86_64-- -passes='require<libcall-lowering-info>,expand-ir-insts' < %s | FileCheck %s
 
-define i129 @halftosi129(half %a) {
+define i129 @halftosi129(half %a) !prof !0 {
 ; CHECK-LABEL: @halftosi129(
 ; CHECK-NEXT:    [[TMP1:%.*]] = fptosi half [[A:%.*]] to i32
 ; CHECK-NEXT:    [[TMP2:%.*]] = sext i32 [[TMP1]] to i129
@@ -12,29 +12,29 @@ define i129 @halftosi129(half %a) {
   ret i129 %conv
 }
 
-define i129 @floattosi129(float %a) {
+define i129 @floattosi129(float %a) !prof !0 {
 ; CHECK-LABEL: @floattosi129(
 ; CHECK-NEXT:  fp-to-i-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = bitcast float [[A:%.*]] to i32
 ; CHECK-NEXT:    [[TMP1:%.*]] = zext i32 [[TMP0]] to i129
 ; CHECK-NEXT:    [[TMP2:%.*]] = icmp sgt i32 [[TMP0]], -1
-; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1, !prof [[PROF1:![0-9]+]]
 ; CHECK-NEXT:    [[TMP4:%.*]] = lshr i129 [[TMP1]], 23
 ; CHECK-NEXT:    [[TMP5:%.*]] = and i129 [[TMP4]], 255
 ; CHECK-NEXT:    [[TMP6:%.*]] = and i129 [[TMP1]], 8388607
 ; CHECK-NEXT:    [[TMP7:%.*]] = or i129 [[TMP6]], 8388608
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp ult i129 [[TMP5]], 127
-; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]], !prof [[PROF2:![0-9]+]]
 ; CHECK:       fp-to-i-if-end:
 ; CHECK-NEXT:    [[TMP9:%.*]] = add i129 [[TMP5]], -256
 ; CHECK-NEXT:    [[TMP10:%.*]] = icmp ult i129 [[TMP9]], -129
-; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]]
+; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then5:
-; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP2]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
+; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP2]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456, !prof [[PROF3:![0-9]+]]
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP]]
 ; CHECK:       fp-to-i-if-end9:
 ; CHECK-NEXT:    [[TMP12:%.*]] = icmp ult i129 [[TMP5]], 150
-; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then12:
 ; CHECK-NEXT:    [[TMP13:%.*]] = sub i129 150, [[TMP5]]
 ; CHECK-NEXT:    [[TMP14:%.*]] = lshr i129 [[TMP7]], [[TMP13]]
@@ -59,23 +59,23 @@ define i129 @doubletosi129(double %a) {
 ; CHECK-NEXT:    [[TMP0:%.*]] = bitcast double [[A:%.*]] to i64
 ; CHECK-NEXT:    [[TMP1:%.*]] = zext i64 [[TMP0]] to i129
 ; CHECK-NEXT:    [[TMP2:%.*]] = icmp sgt i64 [[TMP0]], -1
-; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1, !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP4:%.*]] = lshr i129 [[TMP1]], 52
 ; CHECK-NEXT:    [[TMP5:%.*]] = and i129 [[TMP4]], 2047
 ; CHECK-NEXT:    [[TMP6:%.*]] = and i129 [[TMP1]], 4503599627370495
 ; CHECK-NEXT:    [[TMP7:%.*]] = or i129 [[TMP6]], 4503599627370496
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp ult i129 [[TMP5]], 1023
-; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-end:
 ; CHECK-NEXT:    [[TMP9:%.*]] = add i129 [[TMP5]], -1152
 ; CHECK-NEXT:    [[TMP10:%.*]] = icmp ult i129 [[TMP9]], -129
-; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]]
+; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then5:
 ; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP2]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP]]
 ; CHECK:       fp-to-i-if-end9:
 ; CHECK-NEXT:    [[TMP12:%.*]] = icmp ult i129 [[TMP5]], 1075
-; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then12:
 ; CHECK-NEXT:    [[TMP13:%.*]] = sub i129 1075, [[TMP5]]
 ; CHECK-NEXT:    [[TMP14:%.*]] = lshr i129 [[TMP7]], [[TMP13]]
@@ -101,23 +101,23 @@ define i129 @x86_fp80tosi129(x86_fp80 %a) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = bitcast fp128 [[TMP0]] to i128
 ; CHECK-NEXT:    [[TMP2:%.*]] = zext i128 [[TMP1]] to i129
 ; CHECK-NEXT:    [[TMP3:%.*]] = icmp sgt i128 [[TMP1]], -1
-; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP3]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP3]], i129 1, i129 -1, !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP5:%.*]] = lshr i129 [[TMP2]], 112
 ; CHECK-NEXT:    [[TMP6:%.*]] = and i129 [[TMP5]], 32767
 ; CHECK-NEXT:    [[TMP7:%.*]] = and i129 [[TMP2]], 5192296858534827628530496329220095
 ; CHECK-NEXT:    [[TMP8:%.*]] = or i129 [[TMP7]], 5192296858534827628530496329220096
 ; CHECK-NEXT:    [[TMP9:%.*]] = icmp ult i129 [[TMP6]], 16383
-; CHECK-NEXT:    br i1 [[TMP9]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP9]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-end:
 ; CHECK-NEXT:    [[TMP10:%.*]] = add i129 [[TMP6]], -16512
 ; CHECK-NEXT:    [[TMP11:%.*]] = icmp ult i129 [[TMP10]], -129
-; CHECK-NEXT:    br i1 [[TMP11]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]]
+; CHECK-NEXT:    br i1 [[TMP11]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then5:
 ; CHECK-NEXT:    [[TMP12:%.*]] = select i1 [[TMP3]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP]]
 ; CHECK:       fp-to-i-if-end9:
 ; CHECK-NEXT:    [[TMP13:%.*]] = icmp ult i129 [[TMP6]], 16495
-; CHECK-NEXT:    br i1 [[TMP13]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP13]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then12:
 ; CHECK-NEXT:    [[TMP14:%.*]] = sub i129 16495, [[TMP6]]
 ; CHECK-NEXT:    [[TMP15:%.*]] = lshr i129 [[TMP8]], [[TMP14]]
@@ -142,23 +142,23 @@ define i129 @fp128tosi129(fp128 %a) {
 ; CHECK-NEXT:    [[TMP0:%.*]] = bitcast fp128 [[A:%.*]] to i128
 ; CHECK-NEXT:    [[TMP1:%.*]] = zext i128 [[TMP0]] to i129
 ; CHECK-NEXT:    [[TMP2:%.*]] = icmp sgt i128 [[TMP0]], -1
-; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1, !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP4:%.*]] = lshr i129 [[TMP1]], 112
 ; CHECK-NEXT:    [[TMP5:%.*]] = and i129 [[TMP4]], 32767
 ; CHECK-NEXT:    [[TMP6:%.*]] = and i129 [[TMP1]], 5192296858534827628530496329220095
 ; CHECK-NEXT:    [[TMP7:%.*]] = or i129 [[TMP6]], 5192296858534827628530496329220096
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp ult i129 [[TMP5]], 16383
-; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-end:
 ; CHECK-NEXT:    [[TMP9:%.*]] = add i129 [[TMP5]], -16512
 ; CHECK-NEXT:    [[TMP10:%.*]] = icmp ult i129 [[TMP9]], -129
-; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]]
+; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then5:
 ; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP2]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP]]
 ; CHECK:       fp-to-i-if-end9:
 ; CHECK-NEXT:    [[TMP12:%.*]] = icmp ult i129 [[TMP5]], 16495
-; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then12:
 ; CHECK-NEXT:    [[TMP13:%.*]] = sub i129 16495, [[TMP5]]
 ; CHECK-NEXT:    [[TMP14:%.*]] = lshr i129 [[TMP7]], [[TMP13]]
@@ -184,23 +184,23 @@ define <2 x i129> @floattosi129v2(<2 x float> %a) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = bitcast float [[TMP0]] to i32
 ; CHECK-NEXT:    [[TMP2:%.*]] = zext i32 [[TMP1]] to i129
 ; CHECK-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP1]], -1
-; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP3]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP3]], i129 1, i129 -1, !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP5:%.*]] = lshr i129 [[TMP2]], 23
 ; CHECK-NEXT:    [[TMP6:%.*]] = and i129 [[TMP5]], 255
 ; CHECK-NEXT:    [[TMP7:%.*]] = and i129 [[TMP2]], 8388607
 ; CHECK-NEXT:    [[TMP8:%.*]] = or i129 [[TMP7]], 8388608
 ; CHECK-NEXT:    [[TMP9:%.*]] = icmp ult i129 [[TMP6]], 127
-; CHECK-NEXT:    br i1 [[TMP9]], label [[FP_TO_I_CLEANUP1:%.*]], label [[FP_TO_I_IF_END2:%.*]]
+; CHECK-NEXT:    br i1 [[TMP9]], label [[FP_TO_I_CLEANUP1:%.*]], label [[FP_TO_I_IF_END2:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-end2:
 ; CHECK-NEXT:    [[TMP10:%.*]] = add i129 [[TMP6]], -256
 ; CHECK-NEXT:    [[TMP11:%.*]] = icmp ult i129 [[TMP10]], -129
-; CHECK-NEXT:    br i1 [[TMP11]], label [[FP_TO_I_IF_THEN53:%.*]], label [[FP_TO_I_IF_END94:%.*]]
+; CHECK-NEXT:    br i1 [[TMP11]], label [[FP_TO_I_IF_THEN53:%.*]], label [[FP_TO_I_IF_END94:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then53:
 ; CHECK-NEXT:    [[TMP12:%.*]] = select i1 [[TMP3]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP1]]
 ; CHECK:       fp-to-i-if-end94:
 ; CHECK-NEXT:    [[TMP13:%.*]] = icmp ult i129 [[TMP6]], 150
-; CHECK-NEXT:    br i1 [[TMP13]], label [[FP_TO_I_IF_THEN125:%.*]], label [[FP_TO_I_IF_ELSE6:%.*]]
+; CHECK-NEXT:    br i1 [[TMP13]], label [[FP_TO_I_IF_THEN125:%.*]], label [[FP_TO_I_IF_ELSE6:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then125:
 ; CHECK-NEXT:    [[TMP14:%.*]] = sub i129 150, [[TMP6]]
 ; CHECK-NEXT:    [[TMP15:%.*]] = lshr i129 [[TMP8]], [[TMP14]]
@@ -218,23 +218,23 @@ define <2 x i129> @floattosi129v2(<2 x float> %a) {
 ; CHECK-NEXT:    [[TMP23:%.*]] = bitcast float [[TMP22]] to i32
 ; CHECK-NEXT:    [[TMP24:%.*]] = zext i32 [[TMP23]] to i129
 ; CHECK-NEXT:    [[TMP25:%.*]] = icmp sgt i32 [[TMP23]], -1
-; CHECK-NEXT:    [[TMP26:%.*]] = select i1 [[TMP25]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP26:%.*]] = select i1 [[TMP25]], i129 1, i129 -1, !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP27:%.*]] = lshr i129 [[TMP24]], 23
 ; CHECK-NEXT:    [[TMP28:%.*]] = and i129 [[TMP27]], 255
 ; CHECK-NEXT:    [[TMP29:%.*]] = and i129 [[TMP24]], 8388607
 ; CHECK-NEXT:    [[TMP30:%.*]] = or i129 [[TMP29]], 8388608
 ; CHECK-NEXT:    [[TMP31:%.*]] = icmp ult i129 [[TMP28]], 127
-; CHECK-NEXT:    br i1 [[TMP31]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP31]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-end:
 ; CHECK-NEXT:    [[TMP32:%.*]] = add i129 [[TMP28]], -256
 ; CHECK-NEXT:    [[TMP33:%.*]] = icmp ult i129 [[TMP32]], -129
-; CHECK-NEXT:    br i1 [[TMP33]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]]
+; CHECK-NEXT:    br i1 [[TMP33]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then5:
 ; CHECK-NEXT:    [[TMP34:%.*]] = select i1 [[TMP25]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP]]
 ; CHECK:       fp-to-i-if-end9:
 ; CHECK-NEXT:    [[TMP35:%.*]] = icmp ult i129 [[TMP28]], 150
-; CHECK-NEXT:    br i1 [[TMP35]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP35]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then12:
 ; CHECK-NEXT:    [[TMP36:%.*]] = sub i129 150, [[TMP28]]
 ; CHECK-NEXT:    [[TMP37:%.*]] = lshr i129 [[TMP30]], [[TMP36]]
@@ -253,3 +253,11 @@ define <2 x i129> @floattosi129v2(<2 x float> %a) {
   %conv = fptosi <2 x float> %a to <2 x i129>
   ret <2 x i129> %conv
 }
+
+!0 = !{!"function_entry_count", i64 1000}
+;.
+; CHECK: [[META0:![0-9]+]] = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF1]] = !{!"branch_weights", i32 1048575, i32 1}
+; CHECK: [[PROF2]] = !{!"branch_weights", i32 1, i32 1048575}
+; CHECK: [[PROF3]] = !{!"unknown", !"expand-ir-insts"}
+;.
diff --git a/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptoui129.ll b/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptoui129.ll
index 07de91d404988..179ae9561512d 100644
--- a/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptoui129.ll
+++ b/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptoui129.ll
@@ -1,8 +1,8 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
 ; RUN: opt -S -mtriple=x86_64-- --expand-ir-insts < %s | FileCheck %s
 ; RUN: opt -S -mtriple=x86_64-- -passes='require<libcall-lowering-info>,expand-ir-insts' < %s | FileCheck %s
 
-define i129 @halftoui129(half %a) {
+define i129 @halftoui129(half %a) !prof !0 {
 ; CHECK-LABEL: @halftoui129(
 ; CHECK-NEXT:    [[TMP1:%.*]] = fptoui half [[A:%.*]] to i32
 ; CHECK-NEXT:    [[TMP2:%.*]] = zext i32 [[TMP1]] to i129
@@ -12,29 +12,29 @@ define i129 @halftoui129(half %a) {
   ret i129 %conv
 }
 
-define i129 @floattoui129(float %a) {
+define i129 @floattoui129(float %a)  !prof !0 {
 ; CHECK-LABEL: @floattoui129(
 ; CHECK-NEXT:  fp-to-i-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = bitcast float [[A:%.*]] to i32
 ; CHECK-NEXT:    [[TMP1:%.*]] = zext i32 [[TMP0]] to i129
 ; CHECK-NEXT:    [[TMP2:%.*]] = icmp sgt i32 [[TMP0]], -1
-; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1, !prof [[PROF1:![0-9]+]]
 ; CHECK-NEXT:    [[TMP4:%.*]] = lshr i129 [[TMP1]], 23
 ; CHECK-NEXT:    [[TMP5:%.*]] = and i129 [[TMP4]], 255
 ; CHECK-NEXT:    [[TMP6:%.*]] = and i129 [[TMP1]], 8388607
 ; CHECK-NEXT:    [[TMP7:%.*]] = or i129 [[TMP6]], 8388608
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp ult i129 [[TMP5]], 127
-; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]], !prof [[PROF2:![0-9]+]]
 ; CHECK:       fp-to-i-if-end:
 ; CHECK-NEXT:    [[TMP9:%.*]] = add i129 [[TMP5]], -256
 ; CHECK-NEXT:    [[TMP10:%.*]] = icmp ult i129 [[TMP9]], -129
-; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]]
+; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then5:
-; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP2]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
+; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP2]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456, !prof [[PROF3:![0-9]+]]
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP]]
 ; CHECK:       fp-to-i-if-end9:
 ; CHECK-NEXT:    [[TMP12:%.*]] = icmp ult i129 [[TMP5]], 150
-; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then12:
 ; CHECK-NEXT:    [[TMP13:%.*]] = sub i129 150, [[TMP5]]
 ; CHECK-NEXT:    [[TMP14:%.*]] = lshr i129 [[TMP7]], [[TMP13]]
@@ -59,23 +59,23 @@ define i129 @doubletoui129(double %a) {
 ; CHECK-NEXT:    [[TMP0:%.*]] = bitcast double [[A:%.*]] to i64
 ; CHECK-NEXT:    [[TMP1:%.*]] = zext i64 [[TMP0]] to i129
 ; CHECK-NEXT:    [[TMP2:%.*]] = icmp sgt i64 [[TMP0]], -1
-; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1, !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP4:%.*]] = lshr i129 [[TMP1]], 52
 ; CHECK-NEXT:    [[TMP5:%.*]] = and i129 [[TMP4]], 2047
 ; CHECK-NEXT:    [[TMP6:%.*]] = and i129 [[TMP1]], 4503599627370495
 ; CHECK-NEXT:    [[TMP7:%.*]] = or i129 [[TMP6]], 4503599627370496
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp ult i129 [[TMP5]], 1023
-; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-end:
 ; CHECK-NEXT:    [[TMP9:%.*]] = add i129 [[TMP5]], -1152
 ; CHECK-NEXT:    [[TMP10:%.*]] = icmp ult i129 [[TMP9]], -129
-; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]]
+; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then5:
 ; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP2]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP]]
 ; CHECK:       fp-to-i-if-end9:
 ; CHECK-NEXT:    [[TMP12:%.*]] = icmp ult i129 [[TMP5]], 1075
-; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then12:
 ; CHECK-NEXT:    [[TMP13:%.*]] = sub i129 1075, [[TMP5]]
 ; CHECK-NEXT:    [[TMP14:%.*]] = lshr i129 [[TMP7]], [[TMP13]]
@@ -101,23 +101,23 @@ define i129 @x86_fp80toui129(x86_fp80 %a) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = bitcast fp128 [[TMP0]] to i128
 ; CHECK-NEXT:    [[TMP2:%.*]] = zext i128 [[TMP1]] to i129
 ; CHECK-NEXT:    [[TMP3:%.*]] = icmp sgt i128 [[TMP1]], -1
-; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP3]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP3]], i129 1, i129 -1, !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP5:%.*]] = lshr i129 [[TMP2]], 112
 ; CHECK-NEXT:    [[TMP6:%.*]] = and i129 [[TMP5]], 32767
 ; CHECK-NEXT:    [[TMP7:%.*]] = and i129 [[TMP2]], 5192296858534827628530496329220095
 ; CHECK-NEXT:    [[TMP8:%.*]] = or i129 [[TMP7]], 5192296858534827628530496329220096
 ; CHECK-NEXT:    [[TMP9:%.*]] = icmp ult i129 [[TMP6]], 16383
-; CHECK-NEXT:    br i1 [[TMP9]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP9]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-end:
 ; CHECK-NEXT:    [[TMP10:%.*]] = add i129 [[TMP6]], -16512
 ; CHECK-NEXT:    [[TMP11:%.*]] = icmp ult i129 [[TMP10]], -129
-; CHECK-NEXT:    br i1 [[TMP11]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]]
+; CHECK-NEXT:    br i1 [[TMP11]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then5:
 ; CHECK-NEXT:    [[TMP12:%.*]] = select i1 [[TMP3]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP]]
 ; CHECK:       fp-to-i-if-end9:
 ; CHECK-NEXT:    [[TMP13:%.*]] = icmp ult i129 [[TMP6]], 16495
-; CHECK-NEXT:    br i1 [[TMP13]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP13]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then12:
 ; CHECK-NEXT:    [[TMP14:%.*]] = sub i129 16495, [[TMP6]]
 ; CHECK-NEXT:    [[TMP15:%.*]] = lshr i129 [[TMP8]], [[TMP14]]
@@ -142,23 +142,23 @@ define i129 @fp128toui129(fp128 %a) {
 ; CHECK-NEXT:    [[TMP0:%.*]] = bitcast fp128 [[A:%.*]] to i128
 ; CHECK-NEXT:    [[TMP1:%.*]] = zext i128 [[TMP0]] to i129
 ; CHECK-NEXT:    [[TMP2:%.*]] = icmp sgt i128 [[TMP0]], -1
-; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i129 1, i129 -1, !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP4:%.*]] = lshr i129 [[TMP1]], 112
 ; CHECK-NEXT:    [[TMP5:%.*]] = and i129 [[TMP4]], 32767
 ; CHECK-NEXT:    [[TMP6:%.*]] = and i129 [[TMP1]], 5192296858534827628530496329220095
 ; CHECK-NEXT:    [[TMP7:%.*]] = or i129 [[TMP6]], 5192296858534827628530496329220096
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp ult i129 [[TMP5]], 16383
-; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-end:
 ; CHECK-NEXT:    [[TMP9:%.*]] = add i129 [[TMP5]], -16512
 ; CHECK-NEXT:    [[TMP10:%.*]] = icmp ult i129 [[TMP9]], -129
-; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]]
+; CHECK-NEXT:    br i1 [[TMP10]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then5:
 ; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP2]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP]]
 ; CHECK:       fp-to-i-if-end9:
 ; CHECK-NEXT:    [[TMP12:%.*]] = icmp ult i129 [[TMP5]], 16495
-; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP12]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then12:
 ; CHECK-NEXT:    [[TMP13:%.*]] = sub i129 16495, [[TMP5]]
 ; CHECK-NEXT:    [[TMP14:%.*]] = lshr i129 [[TMP7]], [[TMP13]]
@@ -184,23 +184,23 @@ define <2 x i129> @floattoui129v2(<2 x float> %a) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = bitcast float [[TMP0]] to i32
 ; CHECK-NEXT:    [[TMP2:%.*]] = zext i32 [[TMP1]] to i129
 ; CHECK-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP1]], -1
-; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP3]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP3]], i129 1, i129 -1, !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP5:%.*]] = lshr i129 [[TMP2]], 23
 ; CHECK-NEXT:    [[TMP6:%.*]] = and i129 [[TMP5]], 255
 ; CHECK-NEXT:    [[TMP7:%.*]] = and i129 [[TMP2]], 8388607
 ; CHECK-NEXT:    [[TMP8:%.*]] = or i129 [[TMP7]], 8388608
 ; CHECK-NEXT:    [[TMP9:%.*]] = icmp ult i129 [[TMP6]], 127
-; CHECK-NEXT:    br i1 [[TMP9]], label [[FP_TO_I_CLEANUP1:%.*]], label [[FP_TO_I_IF_END2:%.*]]
+; CHECK-NEXT:    br i1 [[TMP9]], label [[FP_TO_I_CLEANUP1:%.*]], label [[FP_TO_I_IF_END2:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-end2:
 ; CHECK-NEXT:    [[TMP10:%.*]] = add i129 [[TMP6]], -256
 ; CHECK-NEXT:    [[TMP11:%.*]] = icmp ult i129 [[TMP10]], -129
-; CHECK-NEXT:    br i1 [[TMP11]], label [[FP_TO_I_IF_THEN53:%.*]], label [[FP_TO_I_IF_END94:%.*]]
+; CHECK-NEXT:    br i1 [[TMP11]], label [[FP_TO_I_IF_THEN53:%.*]], label [[FP_TO_I_IF_END94:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then53:
 ; CHECK-NEXT:    [[TMP12:%.*]] = select i1 [[TMP3]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP1]]
 ; CHECK:       fp-to-i-if-end94:
 ; CHECK-NEXT:    [[TMP13:%.*]] = icmp ult i129 [[TMP6]], 150
-; CHECK-NEXT:    br i1 [[TMP13]], label [[FP_TO_I_IF_THEN125:%.*]], label [[FP_TO_I_IF_ELSE6:%.*]]
+; CHECK-NEXT:    br i1 [[TMP13]], label [[FP_TO_I_IF_THEN125:%.*]], label [[FP_TO_I_IF_ELSE6:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then125:
 ; CHECK-NEXT:    [[TMP14:%.*]] = sub i129 150, [[TMP6]]
 ; CHECK-NEXT:    [[TMP15:%.*]] = lshr i129 [[TMP8]], [[TMP14]]
@@ -218,23 +218,23 @@ define <2 x i129> @floattoui129v2(<2 x float> %a) {
 ; CHECK-NEXT:    [[TMP23:%.*]] = bitcast float [[TMP22]] to i32
 ; CHECK-NEXT:    [[TMP24:%.*]] = zext i32 [[TMP23]] to i129
 ; CHECK-NEXT:    [[TMP25:%.*]] = icmp sgt i32 [[TMP23]], -1
-; CHECK-NEXT:    [[TMP26:%.*]] = select i1 [[TMP25]], i129 1, i129 -1
+; CHECK-NEXT:    [[TMP26:%.*]] = select i1 [[TMP25]], i129 1, i129 -1, !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP27:%.*]] = lshr i129 [[TMP24]], 23
 ; CHECK-NEXT:    [[TMP28:%.*]] = and i129 [[TMP27]], 255
 ; CHECK-NEXT:    [[TMP29:%.*]] = and i129 [[TMP24]], 8388607
 ; CHECK-NEXT:    [[TMP30:%.*]] = or i129 [[TMP29]], 8388608
 ; CHECK-NEXT:    [[TMP31:%.*]] = icmp ult i129 [[TMP28]], 127
-; CHECK-NEXT:    br i1 [[TMP31]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP31]], label [[FP_TO_I_CLEANUP:%.*]], label [[FP_TO_I_IF_END:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-end:
 ; CHECK-NEXT:    [[TMP32:%.*]] = add i129 [[TMP28]], -256
 ; CHECK-NEXT:    [[TMP33:%.*]] = icmp ult i129 [[TMP32]], -129
-; CHECK-NEXT:    br i1 [[TMP33]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]]
+; CHECK-NEXT:    br i1 [[TMP33]], label [[FP_TO_I_IF_THEN5:%.*]], label [[FP_TO_I_IF_END9:%.*]], !prof [[PROF2]]
 ; CHECK:       fp-to-i-if-then5:
 ; CHECK-NEXT:    [[TMP34:%.*]] = select i1 [[TMP25]], i129 340282366920938463463374607431768211455, i129 -340282366920938463463374607431768211456
 ; CHECK-NEXT:    br label [[FP_TO_I_CLEANUP]]
 ; CHECK:       fp-to-i-if-end9:
 ; CHECK-NEXT:    [[TMP35:%.*]] = icmp ult i129 [[TMP28]], 150
-; CHECK-NEXT:    br i1 [[TMP35]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP35]], label [[FP_TO_I_IF_THEN12:%.*]], label [[FP_TO_I_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       fp-to-i-if-then12:
 ; CHECK-NEXT:    [[TMP36:%.*]] = sub i129 150, [[TMP28]]
 ; CHECK-NEXT:    [[TMP37:%.*]] = lshr i129 [[TMP30]], [[TMP36]]
@@ -253,3 +253,11 @@ define <2 x i129> @floattoui129v2(<2 x float> %a) {
   %conv = fptoui <2 x float> %a to <2 x i129>
   ret <2 x i129> %conv
 }
+
+!0 = !{!"function_entry_count", i64 1000}
+;.
+; CHECK: [[META0:![0-9]+]] = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF1]] = !{!"branch_weights", i32 1048575, i32 1}
+; CHECK: [[PROF2]] = !{!"branch_weights", i32 1, i32 1048575}
+; CHECK: [[PROF3]] = !{!"unknown", !"expand-ir-insts"}
+;.
diff --git a/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-si129tofp.ll b/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-si129tofp.ll
index fab6e431872e7..5c7f56caedb4f 100644
--- a/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-si129tofp.ll
+++ b/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-si129tofp.ll
@@ -1,12 +1,12 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
 ; RUN: opt -S -mtriple=x86_64-- --expand-ir-insts < %s | FileCheck %s
 ; RUN: opt -S -mtriple=x86_64-- -passes='require<libcall-lowering-info>,expand-ir-insts' < %s | FileCheck %s
 
-define half @si129tohalf(i129 %a) {
+define half @si129tohalf(i129 %a) !prof !0 {
 ; CHECK-LABEL: @si129tohalf(
 ; CHECK-NEXT:  itofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i129 [[A:%.*]], 0
-; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1:![0-9]+]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP1:%.*]] = ashr i129 [[A]], 128
 ; CHECK-NEXT:    [[TMP2:%.*]] = xor i129 [[TMP1]], [[A]]
@@ -16,12 +16,12 @@ define half @si129tohalf(i129 %a) {
 ; CHECK-NEXT:    [[TMP6:%.*]] = sub i32 129, [[TMP5]]
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i32 128, [[TMP5]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp sgt i32 [[TMP6]], 24
-; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i32 [[TMP6]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i32 25, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i32 26, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2:![0-9]+]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP9:%.*]] = shl i129 [[TMP3]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -51,7 +51,7 @@ define half @si129tohalf(i129 %a) {
 ; CHECK-NEXT:    [[TMP29:%.*]] = trunc i129 [[TMP27]] to i32
 ; CHECK-NEXT:    [[TMP30:%.*]] = lshr i129 [[TMP27]], 32
 ; CHECK-NEXT:    [[TMP31:%.*]] = trunc i129 [[TMP30]] to i32
-; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP32:%.*]] = ashr i129 [[TMP26]], 3
 ; CHECK-NEXT:    [[TMP33:%.*]] = trunc i129 [[TMP32]] to i32
@@ -91,7 +91,7 @@ define float @si129tofloat(i129 %a) {
 ; CHECK-LABEL: @si129tofloat(
 ; CHECK-NEXT:  itofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i129 [[A:%.*]], 0
-; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP1:%.*]] = ashr i129 [[A]], 128
 ; CHECK-NEXT:    [[TMP2:%.*]] = xor i129 [[TMP1]], [[A]]
@@ -101,12 +101,12 @@ define float @si129tofloat(i129 %a) {
 ; CHECK-NEXT:    [[TMP6:%.*]] = sub i32 129, [[TMP5]]
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i32 128, [[TMP5]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp sgt i32 [[TMP6]], 24
-; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i32 [[TMP6]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i32 25, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i32 26, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP9:%.*]] = shl i129 [[TMP3]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -136,7 +136,7 @@ define float @si129tofloat(i129 %a) {
 ; CHECK-NEXT:    [[TMP29:%.*]] = trunc i129 [[TMP27]] to i32
 ; CHECK-NEXT:    [[TMP30:%.*]] = lshr i129 [[TMP27]], 32
 ; CHECK-NEXT:    [[TMP31:%.*]] = trunc i129 [[TMP30]] to i32
-; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP32:%.*]] = ashr i129 [[TMP26]], 3
 ; CHECK-NEXT:    [[TMP33:%.*]] = trunc i129 [[TMP32]] to i32
@@ -175,7 +175,7 @@ define double @si129todouble(i129 %a) {
 ; CHECK-LABEL: @si129todouble(
 ; CHECK-NEXT:  itofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i129 [[A:%.*]], 0
-; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP1:%.*]] = ashr i129 [[A]], 128
 ; CHECK-NEXT:    [[TMP2:%.*]] = xor i129 [[TMP1]], [[A]]
@@ -185,12 +185,12 @@ define double @si129todouble(i129 %a) {
 ; CHECK-NEXT:    [[TMP6:%.*]] = sub i32 129, [[TMP5]]
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i32 128, [[TMP5]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp sgt i32 [[TMP6]], 53
-; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i32 [[TMP6]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i32 54, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i32 55, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP9:%.*]] = shl i129 [[TMP3]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -220,7 +220,7 @@ define double @si129todouble(i129 %a) {
 ; CHECK-NEXT:    [[TMP29:%.*]] = trunc i129 [[TMP27]] to i64
 ; CHECK-NEXT:    [[TMP30:%.*]] = lshr i129 [[TMP27]], 32
 ; CHECK-NEXT:    [[TMP31:%.*]] = trunc i129 [[TMP30]] to i32
-; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP32:%.*]] = ashr i129 [[TMP26]], 3
 ; CHECK-NEXT:    [[TMP33:%.*]] = trunc i129 [[TMP32]] to i64
@@ -264,7 +264,7 @@ define x86_fp80 @si129tox86_fp80(i129 %a) {
 ; CHECK-LABEL: @si129tox86_fp80(
 ; CHECK-NEXT:  itofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i129 [[A:%.*]], 0
-; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP1:%.*]] = ashr i129 [[A]], 128
 ; CHECK-NEXT:    [[TMP2:%.*]] = xor i129 [[TMP1]], [[A]]
@@ -274,12 +274,12 @@ define x86_fp80 @si129tox86_fp80(i129 %a) {
 ; CHECK-NEXT:    [[TMP6:%.*]] = sub i129 129, [[TMP4]]
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i129 128, [[TMP4]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp sgt i129 [[TMP6]], 113
-; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i129 [[TMP6]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i129 114, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i129 115, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP9:%.*]] = shl i129 [[TMP3]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -307,7 +307,7 @@ define x86_fp80 @si129tox86_fp80(i129 %a) {
 ; CHECK-NEXT:    [[TMP27:%.*]] = trunc i129 [[TMP25]] to i128
 ; CHECK-NEXT:    [[TMP28:%.*]] = lshr i129 [[TMP25]], 32
 ; CHECK-NEXT:    [[TMP29:%.*]] = trunc i129 [[TMP7]] to i64
-; CHECK-NEXT:    br i1 [[TMP26]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP26]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP30:%.*]] = ashr i129 [[TMP24]], 3
 ; CHECK-NEXT:    [[TMP31:%.*]] = trunc i129 [[TMP30]] to i128
@@ -348,7 +348,7 @@ define fp128 @si129tofp128(i129 %a) {
 ; CHECK-LABEL: @si129tofp128(
 ; CHECK-NEXT:  itofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i129 [[A:%.*]], 0
-; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP1:%.*]] = ashr i129 [[A]], 128
 ; CHECK-NEXT:    [[TMP2:%.*]] = xor i129 [[TMP1]], [[A]]
@@ -358,12 +358,12 @@ define fp128 @si129tofp128(i129 %a) {
 ; CHECK-NEXT:    [[TMP6:%.*]] = sub i129 129, [[TMP4]]
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i129 128, [[TMP4]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp sgt i129 [[TMP6]], 113
-; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i129 [[TMP6]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i129 114, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i129 115, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP9:%.*]] = shl i129 [[TMP3]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -391,7 +391,7 @@ define fp128 @si129tofp128(i129 %a) {
 ; CHECK-NEXT:    [[TMP27:%.*]] = trunc i129 [[TMP25]] to i128
 ; CHECK-NEXT:    [[TMP28:%.*]] = lshr i129 [[TMP25]], 32
 ; CHECK-NEXT:    [[TMP29:%.*]] = trunc i129 [[TMP7]] to i64
-; CHECK-NEXT:    br i1 [[TMP26]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP26]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP30:%.*]] = ashr i129 [[TMP24]], 3
 ; CHECK-NEXT:    [[TMP31:%.*]] = trunc i129 [[TMP30]] to i128
@@ -432,7 +432,7 @@ define <2 x float> @si129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:  itofp-entryitofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <2 x i129> [[A:%.*]], i64 0
 ; CHECK-NEXT:    [[TMP1:%.*]] = icmp eq i129 [[TMP0]], 0
-; CHECK-NEXT:    br i1 [[TMP1]], label [[ITOFP_RETURN1:%.*]], label [[ITOFP_IF_END2:%.*]]
+; CHECK-NEXT:    br i1 [[TMP1]], label [[ITOFP_RETURN1:%.*]], label [[ITOFP_IF_END2:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end2:
 ; CHECK-NEXT:    [[TMP2:%.*]] = ashr i129 [[TMP0]], 128
 ; CHECK-NEXT:    [[TMP3:%.*]] = xor i129 [[TMP2]], [[TMP0]]
@@ -442,12 +442,12 @@ define <2 x float> @si129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i32 129, [[TMP6]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = sub i32 128, [[TMP6]]
 ; CHECK-NEXT:    [[TMP9:%.*]] = icmp sgt i32 [[TMP7]], 24
-; CHECK-NEXT:    br i1 [[TMP9]], label [[ITOFP_IF_THEN43:%.*]], label [[ITOFP_IF_ELSE8:%.*]]
+; CHECK-NEXT:    br i1 [[TMP9]], label [[ITOFP_IF_THEN43:%.*]], label [[ITOFP_IF_ELSE8:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then43:
 ; CHECK-NEXT:    switch i32 [[TMP7]], label [[ITOFP_SW_DEFAULT5:%.*]] [
 ; CHECK-NEXT:      i32 25, label [[ITOFP_SW_BB4:%.*]]
 ; CHECK-NEXT:      i32 26, label [[ITOFP_SW_EPILOG6:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb4:
 ; CHECK-NEXT:    [[TMP10:%.*]] = shl i129 [[TMP4]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG6]]
@@ -477,7 +477,7 @@ define <2 x float> @si129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:    [[TMP30:%.*]] = trunc i129 [[TMP28]] to i32
 ; CHECK-NEXT:    [[TMP31:%.*]] = lshr i129 [[TMP28]], 32
 ; CHECK-NEXT:    [[TMP32:%.*]] = trunc i129 [[TMP31]] to i32
-; CHECK-NEXT:    br i1 [[TMP29]], label [[ITOFP_IF_END269:%.*]], label [[ITOFP_IF_THEN207:%.*]]
+; CHECK-NEXT:    br i1 [[TMP29]], label [[ITOFP_IF_END269:%.*]], label [[ITOFP_IF_THEN207:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then207:
 ; CHECK-NEXT:    [[TMP33:%.*]] = ashr i129 [[TMP27]], 3
 ; CHECK-NEXT:    [[TMP34:%.*]] = trunc i129 [[TMP33]] to i32
@@ -509,7 +509,7 @@ define <2 x float> @si129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:    [[TMP54:%.*]] = insertelement <2 x float> poison, float [[TMP53]], i64 0
 ; CHECK-NEXT:    [[TMP55:%.*]] = extractelement <2 x i129> [[A]], i64 1
 ; CHECK-NEXT:    [[TMP56:%.*]] = icmp eq i129 [[TMP55]], 0
-; CHECK-NEXT:    br i1 [[TMP56]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP56]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP57:%.*]] = ashr i129 [[TMP55]], 128
 ; CHECK-NEXT:    [[TMP58:%.*]] = xor i129 [[TMP57]], [[TMP55]]
@@ -519,12 +519,12 @@ define <2 x float> @si129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:    [[TMP62:%.*]] = sub i32 129, [[TMP61]]
 ; CHECK-NEXT:    [[TMP63:%.*]] = sub i32 128, [[TMP61]]
 ; CHECK-NEXT:    [[TMP64:%.*]] = icmp sgt i32 [[TMP62]], 24
-; CHECK-NEXT:    br i1 [[TMP64]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP64]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i32 [[TMP62]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i32 25, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i32 26, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP65:%.*]] = shl i129 [[TMP59]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -554,7 +554,7 @@ define <2 x float> @si129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:    [[TMP85:%.*]] = trunc i129 [[TMP83]] to i32
 ; CHECK-NEXT:    [[TMP86:%.*]] = lshr i129 [[TMP83]], 32
 ; CHECK-NEXT:    [[TMP87:%.*]] = trunc i129 [[TMP86]] to i32
-; CHECK-NEXT:    br i1 [[TMP84]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP84]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP88:%.*]] = ashr i129 [[TMP82]], 3
 ; CHECK-NEXT:    [[TMP89:%.*]] = trunc i129 [[TMP88]] to i32
@@ -589,3 +589,12 @@ define <2 x float> @si129tofloatv2(<2 x i129> %a) {
   %conv = sitofp <2 x i129> %a to <2 x float>
   ret <2 x float> %conv
 }
+
+!0 = !{!"function_entry_count", i64 1000}
+;.
+; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+;.
+; CHECK: [[META0:![0-9]+]] = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF1]] = !{!"branch_weights", i32 1048575, i32 1}
+; CHECK: [[PROF2]] = !{!"branch_weights", i32 1048575, i32 1, i32 1}
+;.
diff --git a/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-ui129tofp.ll b/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-ui129tofp.ll
index 3a3a8e40ea8d1..41859b0d3b79c 100644
--- a/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-ui129tofp.ll
+++ b/llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-ui129tofp.ll
@@ -1,12 +1,12 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
 ; RUN: opt -S -mtriple=x86_64-- --expand-ir-insts < %s | FileCheck %s
 ; RUN: opt -S -mtriple=x86_64-- -passes='require<libcall-lowering-info>,expand-ir-insts' < %s | FileCheck %s
 
-define half @ui129tohalf(i129 %a) {
+define half @ui129tohalf(i129 %a) !prof !0 {
 ; CHECK-LABEL: @ui129tohalf(
 ; CHECK-NEXT:  itofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i129 [[A:%.*]], 0
-; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1:![0-9]+]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP1:%.*]] = ashr i129 [[A]], 128
 ; CHECK-NEXT:    [[TMP2:%.*]] = xor i129 [[TMP1]], [[A]]
@@ -16,12 +16,12 @@ define half @ui129tohalf(i129 %a) {
 ; CHECK-NEXT:    [[TMP6:%.*]] = sub i32 129, [[TMP5]]
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i32 128, [[TMP5]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp sgt i32 [[TMP6]], 24
-; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i32 [[TMP6]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i32 25, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i32 26, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2:![0-9]+]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP9:%.*]] = shl i129 [[A]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -51,7 +51,7 @@ define half @ui129tohalf(i129 %a) {
 ; CHECK-NEXT:    [[TMP29:%.*]] = trunc i129 [[TMP27]] to i32
 ; CHECK-NEXT:    [[TMP30:%.*]] = lshr i129 [[TMP27]], 32
 ; CHECK-NEXT:    [[TMP31:%.*]] = trunc i129 [[TMP30]] to i32
-; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP32:%.*]] = lshr i129 [[TMP26]], 3
 ; CHECK-NEXT:    [[TMP33:%.*]] = trunc i129 [[TMP32]] to i32
@@ -91,7 +91,7 @@ define float @ui129tofloat(i129 %a) {
 ; CHECK-LABEL: @ui129tofloat(
 ; CHECK-NEXT:  itofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i129 [[A:%.*]], 0
-; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP1:%.*]] = ashr i129 [[A]], 128
 ; CHECK-NEXT:    [[TMP2:%.*]] = xor i129 [[TMP1]], [[A]]
@@ -101,12 +101,12 @@ define float @ui129tofloat(i129 %a) {
 ; CHECK-NEXT:    [[TMP6:%.*]] = sub i32 129, [[TMP5]]
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i32 128, [[TMP5]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp sgt i32 [[TMP6]], 24
-; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i32 [[TMP6]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i32 25, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i32 26, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP9:%.*]] = shl i129 [[A]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -136,7 +136,7 @@ define float @ui129tofloat(i129 %a) {
 ; CHECK-NEXT:    [[TMP29:%.*]] = trunc i129 [[TMP27]] to i32
 ; CHECK-NEXT:    [[TMP30:%.*]] = lshr i129 [[TMP27]], 32
 ; CHECK-NEXT:    [[TMP31:%.*]] = trunc i129 [[TMP30]] to i32
-; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP32:%.*]] = lshr i129 [[TMP26]], 3
 ; CHECK-NEXT:    [[TMP33:%.*]] = trunc i129 [[TMP32]] to i32
@@ -175,7 +175,7 @@ define double @ui129todouble(i129 %a) {
 ; CHECK-LABEL: @ui129todouble(
 ; CHECK-NEXT:  itofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i129 [[A:%.*]], 0
-; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP1:%.*]] = ashr i129 [[A]], 128
 ; CHECK-NEXT:    [[TMP2:%.*]] = xor i129 [[TMP1]], [[A]]
@@ -185,12 +185,12 @@ define double @ui129todouble(i129 %a) {
 ; CHECK-NEXT:    [[TMP6:%.*]] = sub i32 129, [[TMP5]]
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i32 128, [[TMP5]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp sgt i32 [[TMP6]], 53
-; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i32 [[TMP6]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i32 54, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i32 55, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP9:%.*]] = shl i129 [[A]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -220,7 +220,7 @@ define double @ui129todouble(i129 %a) {
 ; CHECK-NEXT:    [[TMP29:%.*]] = trunc i129 [[TMP27]] to i64
 ; CHECK-NEXT:    [[TMP30:%.*]] = lshr i129 [[TMP27]], 32
 ; CHECK-NEXT:    [[TMP31:%.*]] = trunc i129 [[TMP30]] to i32
-; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP28]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP32:%.*]] = lshr i129 [[TMP26]], 3
 ; CHECK-NEXT:    [[TMP33:%.*]] = trunc i129 [[TMP32]] to i64
@@ -264,7 +264,7 @@ define x86_fp80 @ui129tox86_fp80(i129 %a) {
 ; CHECK-LABEL: @ui129tox86_fp80(
 ; CHECK-NEXT:  itofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i129 [[A:%.*]], 0
-; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP1:%.*]] = ashr i129 [[A]], 128
 ; CHECK-NEXT:    [[TMP2:%.*]] = xor i129 [[TMP1]], [[A]]
@@ -274,12 +274,12 @@ define x86_fp80 @ui129tox86_fp80(i129 %a) {
 ; CHECK-NEXT:    [[TMP6:%.*]] = sub i129 129, [[TMP4]]
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i129 128, [[TMP4]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp sgt i129 [[TMP6]], 113
-; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i129 [[TMP6]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i129 114, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i129 115, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP9:%.*]] = shl i129 [[A]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -307,7 +307,7 @@ define x86_fp80 @ui129tox86_fp80(i129 %a) {
 ; CHECK-NEXT:    [[TMP27:%.*]] = trunc i129 [[TMP25]] to i128
 ; CHECK-NEXT:    [[TMP28:%.*]] = lshr i129 [[TMP25]], 32
 ; CHECK-NEXT:    [[TMP29:%.*]] = trunc i129 [[TMP7]] to i64
-; CHECK-NEXT:    br i1 [[TMP26]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP26]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP30:%.*]] = lshr i129 [[TMP24]], 3
 ; CHECK-NEXT:    [[TMP31:%.*]] = trunc i129 [[TMP30]] to i128
@@ -348,7 +348,7 @@ define fp128 @ui129tofp128(i129 %a) {
 ; CHECK-LABEL: @ui129tofp128(
 ; CHECK-NEXT:  itofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i129 [[A:%.*]], 0
-; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP0]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP1:%.*]] = ashr i129 [[A]], 128
 ; CHECK-NEXT:    [[TMP2:%.*]] = xor i129 [[TMP1]], [[A]]
@@ -358,12 +358,12 @@ define fp128 @ui129tofp128(i129 %a) {
 ; CHECK-NEXT:    [[TMP6:%.*]] = sub i129 129, [[TMP4]]
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i129 128, [[TMP4]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp sgt i129 [[TMP6]], 113
-; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP8]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i129 [[TMP6]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i129 114, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i129 115, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP9:%.*]] = shl i129 [[A]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -391,7 +391,7 @@ define fp128 @ui129tofp128(i129 %a) {
 ; CHECK-NEXT:    [[TMP27:%.*]] = trunc i129 [[TMP25]] to i128
 ; CHECK-NEXT:    [[TMP28:%.*]] = lshr i129 [[TMP25]], 32
 ; CHECK-NEXT:    [[TMP29:%.*]] = trunc i129 [[TMP7]] to i64
-; CHECK-NEXT:    br i1 [[TMP26]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP26]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP30:%.*]] = lshr i129 [[TMP24]], 3
 ; CHECK-NEXT:    [[TMP31:%.*]] = trunc i129 [[TMP30]] to i128
@@ -432,7 +432,7 @@ define <2 x float> @ui129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:  itofp-entryitofp-entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <2 x i129> [[A:%.*]], i64 0
 ; CHECK-NEXT:    [[TMP1:%.*]] = icmp eq i129 [[TMP0]], 0
-; CHECK-NEXT:    br i1 [[TMP1]], label [[ITOFP_RETURN1:%.*]], label [[ITOFP_IF_END2:%.*]]
+; CHECK-NEXT:    br i1 [[TMP1]], label [[ITOFP_RETURN1:%.*]], label [[ITOFP_IF_END2:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end2:
 ; CHECK-NEXT:    [[TMP2:%.*]] = ashr i129 [[TMP0]], 128
 ; CHECK-NEXT:    [[TMP3:%.*]] = xor i129 [[TMP2]], [[TMP0]]
@@ -442,12 +442,12 @@ define <2 x float> @ui129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i32 129, [[TMP6]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = sub i32 128, [[TMP6]]
 ; CHECK-NEXT:    [[TMP9:%.*]] = icmp sgt i32 [[TMP7]], 24
-; CHECK-NEXT:    br i1 [[TMP9]], label [[ITOFP_IF_THEN43:%.*]], label [[ITOFP_IF_ELSE8:%.*]]
+; CHECK-NEXT:    br i1 [[TMP9]], label [[ITOFP_IF_THEN43:%.*]], label [[ITOFP_IF_ELSE8:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then43:
 ; CHECK-NEXT:    switch i32 [[TMP7]], label [[ITOFP_SW_DEFAULT5:%.*]] [
 ; CHECK-NEXT:      i32 25, label [[ITOFP_SW_BB4:%.*]]
 ; CHECK-NEXT:      i32 26, label [[ITOFP_SW_EPILOG6:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb4:
 ; CHECK-NEXT:    [[TMP10:%.*]] = shl i129 [[TMP0]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG6]]
@@ -477,7 +477,7 @@ define <2 x float> @ui129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:    [[TMP30:%.*]] = trunc i129 [[TMP28]] to i32
 ; CHECK-NEXT:    [[TMP31:%.*]] = lshr i129 [[TMP28]], 32
 ; CHECK-NEXT:    [[TMP32:%.*]] = trunc i129 [[TMP31]] to i32
-; CHECK-NEXT:    br i1 [[TMP29]], label [[ITOFP_IF_END269:%.*]], label [[ITOFP_IF_THEN207:%.*]]
+; CHECK-NEXT:    br i1 [[TMP29]], label [[ITOFP_IF_END269:%.*]], label [[ITOFP_IF_THEN207:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then207:
 ; CHECK-NEXT:    [[TMP33:%.*]] = lshr i129 [[TMP27]], 3
 ; CHECK-NEXT:    [[TMP34:%.*]] = trunc i129 [[TMP33]] to i32
@@ -509,7 +509,7 @@ define <2 x float> @ui129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:    [[TMP54:%.*]] = insertelement <2 x float> poison, float [[TMP53]], i64 0
 ; CHECK-NEXT:    [[TMP55:%.*]] = extractelement <2 x i129> [[A]], i64 1
 ; CHECK-NEXT:    [[TMP56:%.*]] = icmp eq i129 [[TMP55]], 0
-; CHECK-NEXT:    br i1 [[TMP56]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]]
+; CHECK-NEXT:    br i1 [[TMP56]], label [[ITOFP_RETURN:%.*]], label [[ITOFP_IF_END:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-end:
 ; CHECK-NEXT:    [[TMP57:%.*]] = ashr i129 [[TMP55]], 128
 ; CHECK-NEXT:    [[TMP58:%.*]] = xor i129 [[TMP57]], [[TMP55]]
@@ -519,12 +519,12 @@ define <2 x float> @ui129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:    [[TMP62:%.*]] = sub i32 129, [[TMP61]]
 ; CHECK-NEXT:    [[TMP63:%.*]] = sub i32 128, [[TMP61]]
 ; CHECK-NEXT:    [[TMP64:%.*]] = icmp sgt i32 [[TMP62]], 24
-; CHECK-NEXT:    br i1 [[TMP64]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 [[TMP64]], label [[ITOFP_IF_THEN4:%.*]], label [[ITOFP_IF_ELSE:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then4:
 ; CHECK-NEXT:    switch i32 [[TMP62]], label [[ITOFP_SW_DEFAULT:%.*]] [
 ; CHECK-NEXT:      i32 25, label [[ITOFP_SW_BB:%.*]]
 ; CHECK-NEXT:      i32 26, label [[ITOFP_SW_EPILOG:%.*]]
-; CHECK-NEXT:    ]
+; CHECK-NEXT:    ], !prof [[PROF2]]
 ; CHECK:       itofp-sw-bb:
 ; CHECK-NEXT:    [[TMP65:%.*]] = shl i129 [[TMP55]], 1
 ; CHECK-NEXT:    br label [[ITOFP_SW_EPILOG]]
@@ -554,7 +554,7 @@ define <2 x float> @ui129tofloatv2(<2 x i129> %a) {
 ; CHECK-NEXT:    [[TMP85:%.*]] = trunc i129 [[TMP83]] to i32
 ; CHECK-NEXT:    [[TMP86:%.*]] = lshr i129 [[TMP83]], 32
 ; CHECK-NEXT:    [[TMP87:%.*]] = trunc i129 [[TMP86]] to i32
-; CHECK-NEXT:    br i1 [[TMP84]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]]
+; CHECK-NEXT:    br i1 [[TMP84]], label [[ITOFP_IF_END26:%.*]], label [[ITOFP_IF_THEN20:%.*]], !prof [[PROF1]]
 ; CHECK:       itofp-if-then20:
 ; CHECK-NEXT:    [[TMP88:%.*]] = lshr i129 [[TMP82]], 3
 ; CHECK-NEXT:    [[TMP89:%.*]] = trunc i129 [[TMP88]] to i32
@@ -589,3 +589,12 @@ define <2 x float> @ui129tofloatv2(<2 x i129> %a) {
   %conv = uitofp <2 x i129> %a to <2 x float>
   ret <2 x float> %conv
 }
+
+!0 = !{!"function_entry_count", i64 1000}
+;.
+; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+;.
+; CHECK: [[META0:![0-9]+]] = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF1]] = !{!"branch_weights", i32 1048575, i32 1}
+; CHECK: [[PROF2]] = !{!"branch_weights", i32 1048575, i32 1, i32 1}
+;.
diff --git a/llvm/test/Transforms/ExpandIRInsts/X86/sdiv129.ll b/llvm/test/Transforms/ExpandIRInsts/X86/sdiv129.ll
index fc823cd543144..9fa4d7a5a5cc1 100644
--- a/llvm/test/Transforms/ExpandIRInsts/X86/sdiv129.ll
+++ b/llvm/test/Transforms/ExpandIRInsts/X86/sdiv129.ll
@@ -2,8 +2,9 @@
 ; RUN: opt -S -mtriple=x86_64-- -expand-ir-insts -expand-div-rem-bits 128 < %s | FileCheck %s
 ; RUN: opt -S -mtriple=x86_64-- -passes='require<libcall-lowering-info>,expand-ir-insts' -expand-div-rem-bits 128 < %s | FileCheck %s
 
-define void @sdiv129(ptr %ptr, ptr %out) nounwind {
+define void @sdiv129(ptr %ptr, ptr %out) nounwind !prof !0 {
 ; CHECK-LABEL: @sdiv129(
+; CHECK: !prof [[PROF_0:![0-9]+]] {
 ; CHECK-NEXT:  _udiv-special-cases:
 ; CHECK-NEXT:    [[A:%.*]] = load i129, ptr [[PTR:%.*]], align 16
 ; CHECK-NEXT:    [[TMP0:%.*]] = freeze i129 [[A]]
@@ -24,11 +25,11 @@ define void @sdiv129(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP15:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP10]], i1 true)
 ; CHECK-NEXT:    [[TMP16:%.*]] = sub i129 [[TMP14]], [[TMP15]]
 ; CHECK-NEXT:    [[TMP17:%.*]] = icmp ugt i129 [[TMP16]], 128
-; CHECK-NEXT:    [[TMP18:%.*]] = select i1 [[TMP13]], i1 true, i1 [[TMP17]]
+; CHECK-NEXT:    [[TMP18:%.*]] = select i1 [[TMP13]], i1 true, i1 [[TMP17]], !prof [[PROF_1:![0-9]+]]
 ; CHECK-NEXT:    [[TMP19:%.*]] = icmp eq i129 [[TMP16]], 128
-; CHECK-NEXT:    [[TMP20:%.*]] = select i1 [[TMP18]], i129 0, i129 [[TMP10]]
-; CHECK-NEXT:    [[TMP21:%.*]] = select i1 [[TMP18]], i1 true, i1 [[TMP19]]
-; CHECK-NEXT:    br i1 [[TMP21]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
+; CHECK-NEXT:    [[TMP20:%.*]] = select i1 [[TMP18]], i129 0, i129 [[TMP10]], !prof [[PROF_1:![0-9]+]]
+; CHECK-NEXT:    [[TMP21:%.*]] = select i1 [[TMP18]], i1 true, i1 [[TMP19]], !prof [[PROF_1:![0-9]+]]
+; CHECK-NEXT:    br i1 [[TMP21]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]], !prof [[PROF_1:![0-9]+]]
 ; CHECK:       udiv-loop-exit:
 ; CHECK-NEXT:    [[TMP22:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP37:%.*]], [[UDIV_DO_WHILE:%.*]] ]
 ; CHECK-NEXT:    [[TMP23:%.*]] = phi i129 [ [[TMP46:%.*]], [[UDIV_BB1]] ], [ [[TMP34:%.*]], [[UDIV_DO_WHILE]] ]
@@ -52,7 +53,7 @@ define void @sdiv129(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP39]] = sub i129 [[TMP32]], [[TMP38]]
 ; CHECK-NEXT:    [[TMP40]] = add i129 [[TMP27]], -1
 ; CHECK-NEXT:    [[TMP41:%.*]] = icmp eq i129 [[TMP40]], 0
-; CHECK-NEXT:    br i1 [[TMP41]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
+; CHECK-NEXT:    br i1 [[TMP41]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]], !prof [[PROF_1:![0-9]+]]
 ; CHECK:       udiv-preheader:
 ; CHECK-NEXT:    [[TMP42]] = lshr i129 [[TMP10]], [[TMP44]]
 ; CHECK-NEXT:    [[TMP43]] = add i129 [[TMP9]], -1
@@ -62,7 +63,7 @@ define void @sdiv129(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP45:%.*]] = sub i129 128, [[TMP16]]
 ; CHECK-NEXT:    [[TMP46]] = shl i129 [[TMP10]], [[TMP45]]
 ; CHECK-NEXT:    [[TMP47:%.*]] = icmp eq i129 [[TMP44]], 0
-; CHECK-NEXT:    br i1 [[TMP47]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
+; CHECK-NEXT:    br i1 [[TMP47]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]], !prof [[PROF_1:![0-9]+]]
 ; CHECK:       udiv-end:
 ; CHECK-NEXT:    [[TMP48:%.*]] = phi i129 [ [[TMP25]], [[UDIV_LOOP_EXIT]] ], [ [[TMP20]], [[_UDIV_SPECIAL_CASES:%.*]] ]
 ; CHECK-NEXT:    [[TMP49:%.*]] = xor i129 [[TMP48]], [[TMP8]]
@@ -75,3 +76,7 @@ define void @sdiv129(ptr %ptr, ptr %out) nounwind {
   store i129 %res, ptr %out
   ret void
 }
+
+!0 = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF_0]] = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF_1]] = !{!"branch_weights", i32 1, i32 1048575}
diff --git a/llvm/test/Transforms/ExpandIRInsts/X86/srem129.ll b/llvm/test/Transforms/ExpandIRInsts/X86/srem129.ll
index 667152228d258..57167e9d8f3a7 100644
--- a/llvm/test/Transforms/ExpandIRInsts/X86/srem129.ll
+++ b/llvm/test/Transforms/ExpandIRInsts/X86/srem129.ll
@@ -1,8 +1,8 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
 ; RUN: opt -S -mtriple=x86_64-- -expand-ir-insts -expand-div-rem-bits 128 < %s | FileCheck %s
 ; RUN: opt -S -mtriple=x86_64-- -passes='require<libcall-lowering-info>,expand-ir-insts' -expand-div-rem-bits 128 < %s | FileCheck %s
 
-define void @test(ptr %ptr, ptr %out) nounwind {
+define void @test(ptr %ptr, ptr %out) nounwind !prof !0 {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  _udiv-special-cases:
 ; CHECK-NEXT:    [[A:%.*]] = load i129, ptr [[PTR:%.*]], align 16
@@ -25,11 +25,11 @@ define void @test(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP16:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP11]], i1 true)
 ; CHECK-NEXT:    [[TMP17:%.*]] = sub i129 [[TMP15]], [[TMP16]]
 ; CHECK-NEXT:    [[TMP18:%.*]] = icmp ugt i129 [[TMP17]], 128
-; CHECK-NEXT:    [[TMP19:%.*]] = select i1 [[TMP14]], i1 true, i1 [[TMP18]]
+; CHECK-NEXT:    [[TMP19:%.*]] = select i1 [[TMP14]], i1 true, i1 [[TMP18]], !prof [[PROF1:![0-9]+]]
 ; CHECK-NEXT:    [[TMP20:%.*]] = icmp eq i129 [[TMP17]], 128
-; CHECK-NEXT:    [[TMP21:%.*]] = select i1 [[TMP19]], i129 0, i129 [[TMP11]]
-; CHECK-NEXT:    [[TMP22:%.*]] = select i1 [[TMP19]], i1 true, i1 [[TMP20]]
-; CHECK-NEXT:    br i1 [[TMP22]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
+; CHECK-NEXT:    [[TMP21:%.*]] = select i1 [[TMP19]], i129 0, i129 [[TMP11]], !prof [[PROF1]]
+; CHECK-NEXT:    [[TMP22:%.*]] = select i1 [[TMP19]], i1 true, i1 [[TMP20]], !prof [[PROF1]]
+; CHECK-NEXT:    br i1 [[TMP22]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]], !prof [[PROF1]]
 ; CHECK:       udiv-loop-exit:
 ; CHECK-NEXT:    [[TMP23:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP38:%.*]], [[UDIV_DO_WHILE:%.*]] ]
 ; CHECK-NEXT:    [[TMP24:%.*]] = phi i129 [ [[TMP47:%.*]], [[UDIV_BB1]] ], [ [[TMP35:%.*]], [[UDIV_DO_WHILE]] ]
@@ -53,7 +53,7 @@ define void @test(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP40]] = sub i129 [[TMP33]], [[TMP39]]
 ; CHECK-NEXT:    [[TMP41]] = add i129 [[TMP28]], -1
 ; CHECK-NEXT:    [[TMP42:%.*]] = icmp eq i129 [[TMP41]], 0
-; CHECK-NEXT:    br i1 [[TMP42]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
+; CHECK-NEXT:    br i1 [[TMP42]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]], !prof [[PROF1]]
 ; CHECK:       udiv-preheader:
 ; CHECK-NEXT:    [[TMP43]] = lshr i129 [[TMP11]], [[TMP45]]
 ; CHECK-NEXT:    [[TMP44]] = add i129 [[TMP10]], -1
@@ -63,7 +63,7 @@ define void @test(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP46:%.*]] = sub i129 128, [[TMP17]]
 ; CHECK-NEXT:    [[TMP47]] = shl i129 [[TMP11]], [[TMP46]]
 ; CHECK-NEXT:    [[TMP48:%.*]] = icmp eq i129 [[TMP45]], 0
-; CHECK-NEXT:    br i1 [[TMP48]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
+; CHECK-NEXT:    br i1 [[TMP48]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]], !prof [[PROF1]]
 ; CHECK:       udiv-end:
 ; CHECK-NEXT:    [[TMP49:%.*]] = phi i129 [ [[TMP26]], [[UDIV_LOOP_EXIT]] ], [ [[TMP21]], [[_UDIV_SPECIAL_CASES:%.*]] ]
 ; CHECK-NEXT:    [[TMP50:%.*]] = mul i129 [[TMP9]], [[TMP49]]
@@ -78,3 +78,12 @@ define void @test(ptr %ptr, ptr %out) nounwind {
   store i129 %res, ptr %out
   ret void
 }
+
+!0 = !{!"function_entry_count", i64 1000}
+;.
+; CHECK: attributes #[[ATTR0:[0-9]+]] = { nounwind }
+; CHECK: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+;.
+; CHECK: [[META0:![0-9]+]] = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF1]] = !{!"branch_weights", i32 1, i32 1048575}
+;.
diff --git a/llvm/test/Transforms/ExpandIRInsts/X86/udiv129.ll b/llvm/test/Transforms/ExpandIRInsts/X86/udiv129.ll
index b2b83815f79b0..d1db517cc7730 100644
--- a/llvm/test/Transforms/ExpandIRInsts/X86/udiv129.ll
+++ b/llvm/test/Transforms/ExpandIRInsts/X86/udiv129.ll
@@ -2,8 +2,9 @@
 ; RUN: opt -S -mtriple=x86_64-- -expand-ir-insts -expand-div-rem-bits 128 < %s | FileCheck %s
 ; RUN: opt -S -mtriple=x86_64-- -passes='require<libcall-lowering-info>,expand-ir-insts' -expand-div-rem-bits 128 < %s | FileCheck %s
 
-define void @test(ptr %ptr, ptr %out) nounwind {
+define void @test(ptr %ptr, ptr %out) nounwind !prof !0 {
 ; CHECK-LABEL: @test(
+; CHECK: !prof [[PROF_0:![0-9]+]] {
 ; CHECK-NEXT:  _udiv-special-cases:
 ; CHECK-NEXT:    [[A:%.*]] = load i129, ptr [[PTR:%.*]], align 16
 ; CHECK-NEXT:    [[TMP0:%.*]] = freeze i129 3
@@ -15,11 +16,11 @@ define void @test(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP6:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP1]], i1 true)
 ; CHECK-NEXT:    [[TMP7:%.*]] = sub i129 [[TMP5]], [[TMP6]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp ugt i129 [[TMP7]], 128
-; CHECK-NEXT:    [[TMP9:%.*]] = select i1 [[TMP4]], i1 true, i1 [[TMP8]]
+; CHECK-NEXT:    [[TMP9:%.*]] = select i1 [[TMP4]], i1 true, i1 [[TMP8]], !prof [[PROF_1:![0-9]+]]
 ; CHECK-NEXT:    [[TMP10:%.*]] = icmp eq i129 [[TMP7]], 128
-; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP9]], i129 0, i129 [[TMP1]]
-; CHECK-NEXT:    [[TMP12:%.*]] = select i1 [[TMP9]], i1 true, i1 [[TMP10]]
-; CHECK-NEXT:    br i1 [[TMP12]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
+; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP9]], i129 0, i129 [[TMP1]], !prof [[PROF_1:![0-9]+]]
+; CHECK-NEXT:    [[TMP12:%.*]] = select i1 [[TMP9]], i1 true, i1 [[TMP10]], !prof [[PROF_1:![0-9]+]]
+; CHECK-NEXT:    br i1 [[TMP12]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]], !prof [[PROF_1:![0-9]+]]
 ; CHECK:       udiv-loop-exit:
 ; CHECK-NEXT:    [[TMP13:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP28:%.*]], [[UDIV_DO_WHILE:%.*]] ]
 ; CHECK-NEXT:    [[TMP14:%.*]] = phi i129 [ [[TMP37:%.*]], [[UDIV_BB1]] ], [ [[TMP25:%.*]], [[UDIV_DO_WHILE]] ]
@@ -43,7 +44,7 @@ define void @test(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP30]] = sub i129 [[TMP23]], [[TMP29]]
 ; CHECK-NEXT:    [[TMP31]] = add i129 [[TMP18]], -1
 ; CHECK-NEXT:    [[TMP32:%.*]] = icmp eq i129 [[TMP31]], 0
-; CHECK-NEXT:    br i1 [[TMP32]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
+; CHECK-NEXT:    br i1 [[TMP32]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]], !prof [[PROF_1:![0-9]+]]
 ; CHECK:       udiv-preheader:
 ; CHECK-NEXT:    [[TMP33]] = lshr i129 [[TMP1]], [[TMP35]]
 ; CHECK-NEXT:    [[TMP34]] = add i129 [[TMP0]], -1
@@ -53,7 +54,7 @@ define void @test(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP36:%.*]] = sub i129 128, [[TMP7]]
 ; CHECK-NEXT:    [[TMP37]] = shl i129 [[TMP1]], [[TMP36]]
 ; CHECK-NEXT:    [[TMP38:%.*]] = icmp eq i129 [[TMP35]], 0
-; CHECK-NEXT:    br i1 [[TMP38]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
+; CHECK-NEXT:    br i1 [[TMP38]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]], !prof [[PROF_1:![0-9]+]]
 ; CHECK:       udiv-end:
 ; CHECK-NEXT:    [[TMP39:%.*]] = phi i129 [ [[TMP16]], [[UDIV_LOOP_EXIT]] ], [ [[TMP11]], [[_UDIV_SPECIAL_CASES:%.*]] ]
 ; CHECK-NEXT:    store i129 [[TMP39]], ptr [[OUT:%.*]], align 16
@@ -64,3 +65,7 @@ define void @test(ptr %ptr, ptr %out) nounwind {
   store i129 %res, ptr %out
   ret void
 }
+
+!0 = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF_0]] = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF_1]] = !{!"branch_weights", i32 1, i32 1048575}
diff --git a/llvm/test/Transforms/ExpandIRInsts/X86/urem129.ll b/llvm/test/Transforms/ExpandIRInsts/X86/urem129.ll
index 46e72001b2c2d..78fc40784e5f8 100644
--- a/llvm/test/Transforms/ExpandIRInsts/X86/urem129.ll
+++ b/llvm/test/Transforms/ExpandIRInsts/X86/urem129.ll
@@ -2,8 +2,9 @@
 ; RUN: opt -S -mtriple=x86_64-- -expand-ir-insts -expand-div-rem-bits 128 < %s | FileCheck %s
 ; RUN: opt -S -mtriple=x86_64-- -passes='require<libcall-lowering-info>,expand-ir-insts' -expand-div-rem-bits 128 < %s | FileCheck %s
 
-define void @test(ptr %ptr, ptr %out) nounwind {
+define void @test(ptr %ptr, ptr %out) nounwind !prof !0 {
 ; CHECK-LABEL: @test(
+; CHECK: !prof [[PROF_0:![0-9]+]] {
 ; CHECK-NEXT:  _udiv-special-cases:
 ; CHECK-NEXT:    [[A:%.*]] = load i129, ptr [[PTR:%.*]], align 16
 ; CHECK-NEXT:    [[TMP0:%.*]] = freeze i129 [[A]]
@@ -17,11 +18,11 @@ define void @test(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP8:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP3]], i1 true)
 ; CHECK-NEXT:    [[TMP9:%.*]] = sub i129 [[TMP7]], [[TMP8]]
 ; CHECK-NEXT:    [[TMP10:%.*]] = icmp ugt i129 [[TMP9]], 128
-; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP6]], i1 true, i1 [[TMP10]]
+; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP6]], i1 true, i1 [[TMP10]], !prof [[PROF_1:![0-9]+]]
 ; CHECK-NEXT:    [[TMP12:%.*]] = icmp eq i129 [[TMP9]], 128
-; CHECK-NEXT:    [[TMP13:%.*]] = select i1 [[TMP11]], i129 0, i129 [[TMP3]]
-; CHECK-NEXT:    [[TMP14:%.*]] = select i1 [[TMP11]], i1 true, i1 [[TMP12]]
-; CHECK-NEXT:    br i1 [[TMP14]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
+; CHECK-NEXT:    [[TMP13:%.*]] = select i1 [[TMP11]], i129 0, i129 [[TMP3]], !prof [[PROF_1:![0-9]+]]
+; CHECK-NEXT:    [[TMP14:%.*]] = select i1 [[TMP11]], i1 true, i1 [[TMP12]], !prof [[PROF_1:![0-9]+]]
+; CHECK-NEXT:    br i1 [[TMP14]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]], !prof [[PROF_1:![0-9]+]]
 ; CHECK:       udiv-loop-exit:
 ; CHECK-NEXT:    [[TMP15:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP30:%.*]], [[UDIV_DO_WHILE:%.*]] ]
 ; CHECK-NEXT:    [[TMP16:%.*]] = phi i129 [ [[TMP39:%.*]], [[UDIV_BB1]] ], [ [[TMP27:%.*]], [[UDIV_DO_WHILE]] ]
@@ -45,7 +46,7 @@ define void @test(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP32]] = sub i129 [[TMP25]], [[TMP31]]
 ; CHECK-NEXT:    [[TMP33]] = add i129 [[TMP20]], -1
 ; CHECK-NEXT:    [[TMP34:%.*]] = icmp eq i129 [[TMP33]], 0
-; CHECK-NEXT:    br i1 [[TMP34]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
+; CHECK-NEXT:    br i1 [[TMP34]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]], !prof [[PROF_1:![0-9]+]]
 ; CHECK:       udiv-preheader:
 ; CHECK-NEXT:    [[TMP35]] = lshr i129 [[TMP3]], [[TMP37]]
 ; CHECK-NEXT:    [[TMP36]] = add i129 [[TMP2]], -1
@@ -55,7 +56,7 @@ define void @test(ptr %ptr, ptr %out) nounwind {
 ; CHECK-NEXT:    [[TMP38:%.*]] = sub i129 128, [[TMP9]]
 ; CHECK-NEXT:    [[TMP39]] = shl i129 [[TMP3]], [[TMP38]]
 ; CHECK-NEXT:    [[TMP40:%.*]] = icmp eq i129 [[TMP37]], 0
-; CHECK-NEXT:    br i1 [[TMP40]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
+; CHECK-NEXT:    br i1 [[TMP40]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]], !prof [[PROF_1:![0-9]+]]
 ; CHECK:       udiv-end:
 ; CHECK-NEXT:    [[TMP41:%.*]] = phi i129 [ [[TMP18]], [[UDIV_LOOP_EXIT]] ], [ [[TMP13]], [[_UDIV_SPECIAL_CASES:%.*]] ]
 ; CHECK-NEXT:    [[TMP42:%.*]] = mul i129 [[TMP1]], [[TMP41]]
@@ -68,3 +69,7 @@ define void @test(ptr %ptr, ptr %out) nounwind {
   store i129 %res, ptr %out
   ret void
 }
+
+!0 = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF_0]] = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF_1]] = !{!"branch_weights", i32 1, i32 1048575}
diff --git a/llvm/test/Transforms/ExpandIRInsts/X86/vector.ll b/llvm/test/Transforms/ExpandIRInsts/X86/vector.ll
index 58e74b8d17b55..0e7f844599c1b 100644
--- a/llvm/test/Transforms/ExpandIRInsts/X86/vector.ll
+++ b/llvm/test/Transforms/ExpandIRInsts/X86/vector.ll
@@ -2,9 +2,9 @@
 ; RUN: opt -S -mtriple=x86_64-- -expand-ir-insts -expand-div-rem-bits 128 < %s | FileCheck %s
 ; RUN: opt -S -mtriple=x86_64-- -passes='require<libcall-lowering-info>,expand-ir-insts' -expand-div-rem-bits 128 < %s | FileCheck %s
 
-define <2 x i129> @sdiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
+define <2 x i129> @sdiv129(<2 x i129> %a, <2 x i129> %b) nounwind !prof !0 {
 ; CHECK-LABEL: define <2 x i129> @sdiv129(
-; CHECK-SAME: <2 x i129> [[A:%.*]], <2 x i129> [[B:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: <2 x i129> [[A:%.*]], <2 x i129> [[B:%.*]]) #[[ATTR0:[0-9]+]] !prof [[PROF0:![0-9]+]] {
 ; CHECK-NEXT:  _udiv-special-cases_udiv-special-cases:
 ; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <2 x i129> [[A]], i64 0
 ; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <2 x i129> [[B]], i64 0
@@ -26,11 +26,11 @@ define <2 x i129> @sdiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP17:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP12]], i1 true)
 ; CHECK-NEXT:    [[TMP18:%.*]] = sub i129 [[TMP16]], [[TMP17]]
 ; CHECK-NEXT:    [[TMP19:%.*]] = icmp ugt i129 [[TMP18]], 128
-; CHECK-NEXT:    [[TMP20:%.*]] = select i1 [[TMP15]], i1 true, i1 [[TMP19]]
+; CHECK-NEXT:    [[TMP20:%.*]] = select i1 [[TMP15]], i1 true, i1 [[TMP19]], !prof [[PROF1:![0-9]+]]
 ; CHECK-NEXT:    [[TMP21:%.*]] = icmp eq i129 [[TMP18]], 128
-; CHECK-NEXT:    [[TMP22:%.*]] = select i1 [[TMP20]], i129 0, i129 [[TMP12]]
-; CHECK-NEXT:    [[TMP23:%.*]] = select i1 [[TMP20]], i1 true, i1 [[TMP21]]
-; CHECK-NEXT:    br i1 [[TMP23]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]]
+; CHECK-NEXT:    [[TMP22:%.*]] = select i1 [[TMP20]], i129 0, i129 [[TMP12]], !prof [[PROF1]]
+; CHECK-NEXT:    [[TMP23:%.*]] = select i1 [[TMP20]], i1 true, i1 [[TMP21]], !prof [[PROF1]]
+; CHECK-NEXT:    br i1 [[TMP23]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]], !prof [[PROF1]]
 ; CHECK:       udiv-loop-exit2:
 ; CHECK-NEXT:    [[TMP24:%.*]] = phi i129 [ 0, [[UDIV_BB15]] ], [ [[TMP39:%.*]], [[UDIV_DO_WHILE3:%.*]] ]
 ; CHECK-NEXT:    [[TMP25:%.*]] = phi i129 [ [[TMP48:%.*]], [[UDIV_BB15]] ], [ [[TMP36:%.*]], [[UDIV_DO_WHILE3]] ]
@@ -54,7 +54,7 @@ define <2 x i129> @sdiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP41]] = sub i129 [[TMP34]], [[TMP40]]
 ; CHECK-NEXT:    [[TMP42]] = add i129 [[TMP29]], -1
 ; CHECK-NEXT:    [[TMP43:%.*]] = icmp eq i129 [[TMP42]], 0
-; CHECK-NEXT:    br i1 [[TMP43]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]]
+; CHECK-NEXT:    br i1 [[TMP43]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]], !prof [[PROF1]]
 ; CHECK:       udiv-preheader4:
 ; CHECK-NEXT:    [[TMP44]] = lshr i129 [[TMP12]], [[TMP46]]
 ; CHECK-NEXT:    [[TMP45]] = add i129 [[TMP11]], -1
@@ -64,7 +64,7 @@ define <2 x i129> @sdiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP47:%.*]] = sub i129 128, [[TMP18]]
 ; CHECK-NEXT:    [[TMP48]] = shl i129 [[TMP12]], [[TMP47]]
 ; CHECK-NEXT:    [[TMP49:%.*]] = icmp eq i129 [[TMP46]], 0
-; CHECK-NEXT:    br i1 [[TMP49]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]]
+; CHECK-NEXT:    br i1 [[TMP49]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]], !prof [[PROF1]]
 ; CHECK:       udiv-end1:
 ; CHECK-NEXT:    [[TMP50:%.*]] = phi i129 [ [[TMP27]], [[UDIV_LOOP_EXIT2]] ], [ [[TMP22]], [[_UDIV_SPECIAL_CASES_UDIV_SPECIAL_CASES:%.*]] ]
 ; CHECK-NEXT:    [[TMP51:%.*]] = xor i129 [[TMP50]], [[TMP10]]
@@ -90,11 +90,11 @@ define <2 x i129> @sdiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP71:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP66]], i1 true)
 ; CHECK-NEXT:    [[TMP72:%.*]] = sub i129 [[TMP70]], [[TMP71]]
 ; CHECK-NEXT:    [[TMP73:%.*]] = icmp ugt i129 [[TMP72]], 128
-; CHECK-NEXT:    [[TMP74:%.*]] = select i1 [[TMP69]], i1 true, i1 [[TMP73]]
+; CHECK-NEXT:    [[TMP74:%.*]] = select i1 [[TMP69]], i1 true, i1 [[TMP73]], !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP75:%.*]] = icmp eq i129 [[TMP72]], 128
-; CHECK-NEXT:    [[TMP76:%.*]] = select i1 [[TMP74]], i129 0, i129 [[TMP66]]
-; CHECK-NEXT:    [[TMP77:%.*]] = select i1 [[TMP74]], i1 true, i1 [[TMP75]]
-; CHECK-NEXT:    br i1 [[TMP77]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
+; CHECK-NEXT:    [[TMP76:%.*]] = select i1 [[TMP74]], i129 0, i129 [[TMP66]], !prof [[PROF1]]
+; CHECK-NEXT:    [[TMP77:%.*]] = select i1 [[TMP74]], i1 true, i1 [[TMP75]], !prof [[PROF1]]
+; CHECK-NEXT:    br i1 [[TMP77]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]], !prof [[PROF1]]
 ; CHECK:       udiv-loop-exit:
 ; CHECK-NEXT:    [[TMP78:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP93:%.*]], [[UDIV_DO_WHILE:%.*]] ]
 ; CHECK-NEXT:    [[TMP79:%.*]] = phi i129 [ [[TMP102:%.*]], [[UDIV_BB1]] ], [ [[TMP90:%.*]], [[UDIV_DO_WHILE]] ]
@@ -118,7 +118,7 @@ define <2 x i129> @sdiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP95]] = sub i129 [[TMP88]], [[TMP94]]
 ; CHECK-NEXT:    [[TMP96]] = add i129 [[TMP83]], -1
 ; CHECK-NEXT:    [[TMP97:%.*]] = icmp eq i129 [[TMP96]], 0
-; CHECK-NEXT:    br i1 [[TMP97]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
+; CHECK-NEXT:    br i1 [[TMP97]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]], !prof [[PROF1]]
 ; CHECK:       udiv-preheader:
 ; CHECK-NEXT:    [[TMP98]] = lshr i129 [[TMP66]], [[TMP100]]
 ; CHECK-NEXT:    [[TMP99]] = add i129 [[TMP65]], -1
@@ -128,7 +128,7 @@ define <2 x i129> @sdiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP101:%.*]] = sub i129 128, [[TMP72]]
 ; CHECK-NEXT:    [[TMP102]] = shl i129 [[TMP66]], [[TMP101]]
 ; CHECK-NEXT:    [[TMP103:%.*]] = icmp eq i129 [[TMP100]], 0
-; CHECK-NEXT:    br i1 [[TMP103]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
+; CHECK-NEXT:    br i1 [[TMP103]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]], !prof [[PROF1]]
 ; CHECK:       udiv-end:
 ; CHECK-NEXT:    [[TMP104:%.*]] = phi i129 [ [[TMP81]], [[UDIV_LOOP_EXIT]] ], [ [[TMP76]], [[UDIV_END1]] ]
 ; CHECK-NEXT:    [[TMP105:%.*]] = xor i129 [[TMP104]], [[TMP64]]
@@ -155,11 +155,11 @@ define <2 x i129> @udiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP8:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP3]], i1 true)
 ; CHECK-NEXT:    [[TMP9:%.*]] = sub i129 [[TMP7]], [[TMP8]]
 ; CHECK-NEXT:    [[TMP10:%.*]] = icmp ugt i129 [[TMP9]], 128
-; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP6]], i1 true, i1 [[TMP10]]
+; CHECK-NEXT:    [[TMP11:%.*]] = select i1 [[TMP6]], i1 true, i1 [[TMP10]], !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP12:%.*]] = icmp eq i129 [[TMP9]], 128
-; CHECK-NEXT:    [[TMP13:%.*]] = select i1 [[TMP11]], i129 0, i129 [[TMP3]]
-; CHECK-NEXT:    [[TMP14:%.*]] = select i1 [[TMP11]], i1 true, i1 [[TMP12]]
-; CHECK-NEXT:    br i1 [[TMP14]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]]
+; CHECK-NEXT:    [[TMP13:%.*]] = select i1 [[TMP11]], i129 0, i129 [[TMP3]], !prof [[PROF1]]
+; CHECK-NEXT:    [[TMP14:%.*]] = select i1 [[TMP11]], i1 true, i1 [[TMP12]], !prof [[PROF1]]
+; CHECK-NEXT:    br i1 [[TMP14]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]], !prof [[PROF1]]
 ; CHECK:       udiv-loop-exit2:
 ; CHECK-NEXT:    [[TMP15:%.*]] = phi i129 [ 0, [[UDIV_BB15]] ], [ [[TMP30:%.*]], [[UDIV_DO_WHILE3:%.*]] ]
 ; CHECK-NEXT:    [[TMP16:%.*]] = phi i129 [ [[TMP39:%.*]], [[UDIV_BB15]] ], [ [[TMP27:%.*]], [[UDIV_DO_WHILE3]] ]
@@ -183,7 +183,7 @@ define <2 x i129> @udiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP32]] = sub i129 [[TMP25]], [[TMP31]]
 ; CHECK-NEXT:    [[TMP33]] = add i129 [[TMP20]], -1
 ; CHECK-NEXT:    [[TMP34:%.*]] = icmp eq i129 [[TMP33]], 0
-; CHECK-NEXT:    br i1 [[TMP34]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]]
+; CHECK-NEXT:    br i1 [[TMP34]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]], !prof [[PROF1]]
 ; CHECK:       udiv-preheader4:
 ; CHECK-NEXT:    [[TMP35]] = lshr i129 [[TMP3]], [[TMP37]]
 ; CHECK-NEXT:    [[TMP36]] = add i129 [[TMP2]], -1
@@ -193,7 +193,7 @@ define <2 x i129> @udiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP38:%.*]] = sub i129 128, [[TMP9]]
 ; CHECK-NEXT:    [[TMP39]] = shl i129 [[TMP3]], [[TMP38]]
 ; CHECK-NEXT:    [[TMP40:%.*]] = icmp eq i129 [[TMP37]], 0
-; CHECK-NEXT:    br i1 [[TMP40]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]]
+; CHECK-NEXT:    br i1 [[TMP40]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]], !prof [[PROF1]]
 ; CHECK:       udiv-end1:
 ; CHECK-NEXT:    [[TMP41:%.*]] = phi i129 [ [[TMP18]], [[UDIV_LOOP_EXIT2]] ], [ [[TMP13]], [[_UDIV_SPECIAL_CASES_UDIV_SPECIAL_CASES:%.*]] ]
 ; CHECK-NEXT:    [[TMP42:%.*]] = insertelement <2 x i129> poison, i129 [[TMP41]], i64 0
@@ -208,11 +208,11 @@ define <2 x i129> @udiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP51:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP46]], i1 true)
 ; CHECK-NEXT:    [[TMP52:%.*]] = sub i129 [[TMP50]], [[TMP51]]
 ; CHECK-NEXT:    [[TMP53:%.*]] = icmp ugt i129 [[TMP52]], 128
-; CHECK-NEXT:    [[TMP54:%.*]] = select i1 [[TMP49]], i1 true, i1 [[TMP53]]
+; CHECK-NEXT:    [[TMP54:%.*]] = select i1 [[TMP49]], i1 true, i1 [[TMP53]], !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP55:%.*]] = icmp eq i129 [[TMP52]], 128
-; CHECK-NEXT:    [[TMP56:%.*]] = select i1 [[TMP54]], i129 0, i129 [[TMP46]]
-; CHECK-NEXT:    [[TMP57:%.*]] = select i1 [[TMP54]], i1 true, i1 [[TMP55]]
-; CHECK-NEXT:    br i1 [[TMP57]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
+; CHECK-NEXT:    [[TMP56:%.*]] = select i1 [[TMP54]], i129 0, i129 [[TMP46]], !prof [[PROF1]]
+; CHECK-NEXT:    [[TMP57:%.*]] = select i1 [[TMP54]], i1 true, i1 [[TMP55]], !prof [[PROF1]]
+; CHECK-NEXT:    br i1 [[TMP57]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]], !prof [[PROF1]]
 ; CHECK:       udiv-loop-exit:
 ; CHECK-NEXT:    [[TMP58:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP73:%.*]], [[UDIV_DO_WHILE:%.*]] ]
 ; CHECK-NEXT:    [[TMP59:%.*]] = phi i129 [ [[TMP82:%.*]], [[UDIV_BB1]] ], [ [[TMP70:%.*]], [[UDIV_DO_WHILE]] ]
@@ -236,7 +236,7 @@ define <2 x i129> @udiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP75]] = sub i129 [[TMP68]], [[TMP74]]
 ; CHECK-NEXT:    [[TMP76]] = add i129 [[TMP63]], -1
 ; CHECK-NEXT:    [[TMP77:%.*]] = icmp eq i129 [[TMP76]], 0
-; CHECK-NEXT:    br i1 [[TMP77]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
+; CHECK-NEXT:    br i1 [[TMP77]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]], !prof [[PROF1]]
 ; CHECK:       udiv-preheader:
 ; CHECK-NEXT:    [[TMP78]] = lshr i129 [[TMP46]], [[TMP80]]
 ; CHECK-NEXT:    [[TMP79]] = add i129 [[TMP45]], -1
@@ -246,7 +246,7 @@ define <2 x i129> @udiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP81:%.*]] = sub i129 128, [[TMP52]]
 ; CHECK-NEXT:    [[TMP82]] = shl i129 [[TMP46]], [[TMP81]]
 ; CHECK-NEXT:    [[TMP83:%.*]] = icmp eq i129 [[TMP80]], 0
-; CHECK-NEXT:    br i1 [[TMP83]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
+; CHECK-NEXT:    br i1 [[TMP83]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]], !prof [[PROF1]]
 ; CHECK:       udiv-end:
 ; CHECK-NEXT:    [[TMP84:%.*]] = phi i129 [ [[TMP61]], [[UDIV_LOOP_EXIT]] ], [ [[TMP56]], [[UDIV_END1]] ]
 ; CHECK-NEXT:    [[TMP85:%.*]] = insertelement <2 x i129> [[TMP42]], i129 [[TMP84]], i64 1
@@ -281,11 +281,11 @@ define <2 x i129> @srem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP18:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP13]], i1 true)
 ; CHECK-NEXT:    [[TMP19:%.*]] = sub i129 [[TMP17]], [[TMP18]]
 ; CHECK-NEXT:    [[TMP20:%.*]] = icmp ugt i129 [[TMP19]], 128
-; CHECK-NEXT:    [[TMP21:%.*]] = select i1 [[TMP16]], i1 true, i1 [[TMP20]]
+; CHECK-NEXT:    [[TMP21:%.*]] = select i1 [[TMP16]], i1 true, i1 [[TMP20]], !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP22:%.*]] = icmp eq i129 [[TMP19]], 128
-; CHECK-NEXT:    [[TMP23:%.*]] = select i1 [[TMP21]], i129 0, i129 [[TMP13]]
-; CHECK-NEXT:    [[TMP24:%.*]] = select i1 [[TMP21]], i1 true, i1 [[TMP22]]
-; CHECK-NEXT:    br i1 [[TMP24]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]]
+; CHECK-NEXT:    [[TMP23:%.*]] = select i1 [[TMP21]], i129 0, i129 [[TMP13]], !prof [[PROF1]]
+; CHECK-NEXT:    [[TMP24:%.*]] = select i1 [[TMP21]], i1 true, i1 [[TMP22]], !prof [[PROF1]]
+; CHECK-NEXT:    br i1 [[TMP24]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]], !prof [[PROF1]]
 ; CHECK:       udiv-loop-exit2:
 ; CHECK-NEXT:    [[TMP25:%.*]] = phi i129 [ 0, [[UDIV_BB15]] ], [ [[TMP40:%.*]], [[UDIV_DO_WHILE3:%.*]] ]
 ; CHECK-NEXT:    [[TMP26:%.*]] = phi i129 [ [[TMP49:%.*]], [[UDIV_BB15]] ], [ [[TMP37:%.*]], [[UDIV_DO_WHILE3]] ]
@@ -309,7 +309,7 @@ define <2 x i129> @srem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP42]] = sub i129 [[TMP35]], [[TMP41]]
 ; CHECK-NEXT:    [[TMP43]] = add i129 [[TMP30]], -1
 ; CHECK-NEXT:    [[TMP44:%.*]] = icmp eq i129 [[TMP43]], 0
-; CHECK-NEXT:    br i1 [[TMP44]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]]
+; CHECK-NEXT:    br i1 [[TMP44]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]], !prof [[PROF1]]
 ; CHECK:       udiv-preheader4:
 ; CHECK-NEXT:    [[TMP45]] = lshr i129 [[TMP13]], [[TMP47]]
 ; CHECK-NEXT:    [[TMP46]] = add i129 [[TMP12]], -1
@@ -319,7 +319,7 @@ define <2 x i129> @srem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP48:%.*]] = sub i129 128, [[TMP19]]
 ; CHECK-NEXT:    [[TMP49]] = shl i129 [[TMP13]], [[TMP48]]
 ; CHECK-NEXT:    [[TMP50:%.*]] = icmp eq i129 [[TMP47]], 0
-; CHECK-NEXT:    br i1 [[TMP50]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]]
+; CHECK-NEXT:    br i1 [[TMP50]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]], !prof [[PROF1]]
 ; CHECK:       udiv-end1:
 ; CHECK-NEXT:    [[TMP51:%.*]] = phi i129 [ [[TMP28]], [[UDIV_LOOP_EXIT2]] ], [ [[TMP23]], [[_UDIV_SPECIAL_CASES_UDIV_SPECIAL_CASES:%.*]] ]
 ; CHECK-NEXT:    [[TMP52:%.*]] = mul i129 [[TMP11]], [[TMP51]]
@@ -348,11 +348,11 @@ define <2 x i129> @srem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP75:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP70]], i1 true)
 ; CHECK-NEXT:    [[TMP76:%.*]] = sub i129 [[TMP74]], [[TMP75]]
 ; CHECK-NEXT:    [[TMP77:%.*]] = icmp ugt i129 [[TMP76]], 128
-; CHECK-NEXT:    [[TMP78:%.*]] = select i1 [[TMP73]], i1 true, i1 [[TMP77]]
+; CHECK-NEXT:    [[TMP78:%.*]] = select i1 [[TMP73]], i1 true, i1 [[TMP77]], !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP79:%.*]] = icmp eq i129 [[TMP76]], 128
-; CHECK-NEXT:    [[TMP80:%.*]] = select i1 [[TMP78]], i129 0, i129 [[TMP70]]
-; CHECK-NEXT:    [[TMP81:%.*]] = select i1 [[TMP78]], i1 true, i1 [[TMP79]]
-; CHECK-NEXT:    br i1 [[TMP81]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
+; CHECK-NEXT:    [[TMP80:%.*]] = select i1 [[TMP78]], i129 0, i129 [[TMP70]], !prof [[PROF1]]
+; CHECK-NEXT:    [[TMP81:%.*]] = select i1 [[TMP78]], i1 true, i1 [[TMP79]], !prof [[PROF1]]
+; CHECK-NEXT:    br i1 [[TMP81]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]], !prof [[PROF1]]
 ; CHECK:       udiv-loop-exit:
 ; CHECK-NEXT:    [[TMP82:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP97:%.*]], [[UDIV_DO_WHILE:%.*]] ]
 ; CHECK-NEXT:    [[TMP83:%.*]] = phi i129 [ [[TMP106:%.*]], [[UDIV_BB1]] ], [ [[TMP94:%.*]], [[UDIV_DO_WHILE]] ]
@@ -376,7 +376,7 @@ define <2 x i129> @srem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP99]] = sub i129 [[TMP92]], [[TMP98]]
 ; CHECK-NEXT:    [[TMP100]] = add i129 [[TMP87]], -1
 ; CHECK-NEXT:    [[TMP101:%.*]] = icmp eq i129 [[TMP100]], 0
-; CHECK-NEXT:    br i1 [[TMP101]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
+; CHECK-NEXT:    br i1 [[TMP101]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]], !prof [[PROF1]]
 ; CHECK:       udiv-preheader:
 ; CHECK-NEXT:    [[TMP102]] = lshr i129 [[TMP70]], [[TMP104]]
 ; CHECK-NEXT:    [[TMP103]] = add i129 [[TMP69]], -1
@@ -386,7 +386,7 @@ define <2 x i129> @srem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP105:%.*]] = sub i129 128, [[TMP76]]
 ; CHECK-NEXT:    [[TMP106]] = shl i129 [[TMP70]], [[TMP105]]
 ; CHECK-NEXT:    [[TMP107:%.*]] = icmp eq i129 [[TMP104]], 0
-; CHECK-NEXT:    br i1 [[TMP107]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
+; CHECK-NEXT:    br i1 [[TMP107]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]], !prof [[PROF1]]
 ; CHECK:       udiv-end:
 ; CHECK-NEXT:    [[TMP108:%.*]] = phi i129 [ [[TMP85]], [[UDIV_LOOP_EXIT]] ], [ [[TMP80]], [[UDIV_END1]] ]
 ; CHECK-NEXT:    [[TMP109:%.*]] = mul i129 [[TMP68]], [[TMP108]]
@@ -417,11 +417,11 @@ define <2 x i129> @urem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP10:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP5]], i1 true)
 ; CHECK-NEXT:    [[TMP11:%.*]] = sub i129 [[TMP9]], [[TMP10]]
 ; CHECK-NEXT:    [[TMP12:%.*]] = icmp ugt i129 [[TMP11]], 128
-; CHECK-NEXT:    [[TMP13:%.*]] = select i1 [[TMP8]], i1 true, i1 [[TMP12]]
+; CHECK-NEXT:    [[TMP13:%.*]] = select i1 [[TMP8]], i1 true, i1 [[TMP12]], !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP14:%.*]] = icmp eq i129 [[TMP11]], 128
-; CHECK-NEXT:    [[TMP15:%.*]] = select i1 [[TMP13]], i129 0, i129 [[TMP5]]
-; CHECK-NEXT:    [[TMP16:%.*]] = select i1 [[TMP13]], i1 true, i1 [[TMP14]]
-; CHECK-NEXT:    br i1 [[TMP16]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]]
+; CHECK-NEXT:    [[TMP15:%.*]] = select i1 [[TMP13]], i129 0, i129 [[TMP5]], !prof [[PROF1]]
+; CHECK-NEXT:    [[TMP16:%.*]] = select i1 [[TMP13]], i1 true, i1 [[TMP14]], !prof [[PROF1]]
+; CHECK-NEXT:    br i1 [[TMP16]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]], !prof [[PROF1]]
 ; CHECK:       udiv-loop-exit2:
 ; CHECK-NEXT:    [[TMP17:%.*]] = phi i129 [ 0, [[UDIV_BB15]] ], [ [[TMP32:%.*]], [[UDIV_DO_WHILE3:%.*]] ]
 ; CHECK-NEXT:    [[TMP18:%.*]] = phi i129 [ [[TMP41:%.*]], [[UDIV_BB15]] ], [ [[TMP29:%.*]], [[UDIV_DO_WHILE3]] ]
@@ -445,7 +445,7 @@ define <2 x i129> @urem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP34]] = sub i129 [[TMP27]], [[TMP33]]
 ; CHECK-NEXT:    [[TMP35]] = add i129 [[TMP22]], -1
 ; CHECK-NEXT:    [[TMP36:%.*]] = icmp eq i129 [[TMP35]], 0
-; CHECK-NEXT:    br i1 [[TMP36]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]]
+; CHECK-NEXT:    br i1 [[TMP36]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]], !prof [[PROF1]]
 ; CHECK:       udiv-preheader4:
 ; CHECK-NEXT:    [[TMP37]] = lshr i129 [[TMP5]], [[TMP39]]
 ; CHECK-NEXT:    [[TMP38]] = add i129 [[TMP4]], -1
@@ -455,7 +455,7 @@ define <2 x i129> @urem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP40:%.*]] = sub i129 128, [[TMP11]]
 ; CHECK-NEXT:    [[TMP41]] = shl i129 [[TMP5]], [[TMP40]]
 ; CHECK-NEXT:    [[TMP42:%.*]] = icmp eq i129 [[TMP39]], 0
-; CHECK-NEXT:    br i1 [[TMP42]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]]
+; CHECK-NEXT:    br i1 [[TMP42]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]], !prof [[PROF1]]
 ; CHECK:       udiv-end1:
 ; CHECK-NEXT:    [[TMP43:%.*]] = phi i129 [ [[TMP20]], [[UDIV_LOOP_EXIT2]] ], [ [[TMP15]], [[_UDIV_SPECIAL_CASES_UDIV_SPECIAL_CASES:%.*]] ]
 ; CHECK-NEXT:    [[TMP44:%.*]] = mul i129 [[TMP3]], [[TMP43]]
@@ -474,11 +474,11 @@ define <2 x i129> @urem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP57:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP52]], i1 true)
 ; CHECK-NEXT:    [[TMP58:%.*]] = sub i129 [[TMP56]], [[TMP57]]
 ; CHECK-NEXT:    [[TMP59:%.*]] = icmp ugt i129 [[TMP58]], 128
-; CHECK-NEXT:    [[TMP60:%.*]] = select i1 [[TMP55]], i1 true, i1 [[TMP59]]
+; CHECK-NEXT:    [[TMP60:%.*]] = select i1 [[TMP55]], i1 true, i1 [[TMP59]], !prof [[PROF1]]
 ; CHECK-NEXT:    [[TMP61:%.*]] = icmp eq i129 [[TMP58]], 128
-; CHECK-NEXT:    [[TMP62:%.*]] = select i1 [[TMP60]], i129 0, i129 [[TMP52]]
-; CHECK-NEXT:    [[TMP63:%.*]] = select i1 [[TMP60]], i1 true, i1 [[TMP61]]
-; CHECK-NEXT:    br i1 [[TMP63]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
+; CHECK-NEXT:    [[TMP62:%.*]] = select i1 [[TMP60]], i129 0, i129 [[TMP52]], !prof [[PROF1]]
+; CHECK-NEXT:    [[TMP63:%.*]] = select i1 [[TMP60]], i1 true, i1 [[TMP61]], !prof [[PROF1]]
+; CHECK-NEXT:    br i1 [[TMP63]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]], !prof [[PROF1]]
 ; CHECK:       udiv-loop-exit:
 ; CHECK-NEXT:    [[TMP64:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP79:%.*]], [[UDIV_DO_WHILE:%.*]] ]
 ; CHECK-NEXT:    [[TMP65:%.*]] = phi i129 [ [[TMP88:%.*]], [[UDIV_BB1]] ], [ [[TMP76:%.*]], [[UDIV_DO_WHILE]] ]
@@ -502,7 +502,7 @@ define <2 x i129> @urem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP81]] = sub i129 [[TMP74]], [[TMP80]]
 ; CHECK-NEXT:    [[TMP82]] = add i129 [[TMP69]], -1
 ; CHECK-NEXT:    [[TMP83:%.*]] = icmp eq i129 [[TMP82]], 0
-; CHECK-NEXT:    br i1 [[TMP83]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
+; CHECK-NEXT:    br i1 [[TMP83]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]], !prof [[PROF1]]
 ; CHECK:       udiv-preheader:
 ; CHECK-NEXT:    [[TMP84]] = lshr i129 [[TMP52]], [[TMP86]]
 ; CHECK-NEXT:    [[TMP85]] = add i129 [[TMP51]], -1
@@ -512,7 +512,7 @@ define <2 x i129> @urem129(<2 x i129> %a, <2 x i129> %b) nounwind {
 ; CHECK-NEXT:    [[TMP87:%.*]] = sub i129 128, [[TMP58]]
 ; CHECK-NEXT:    [[TMP88]] = shl i129 [[TMP52]], [[TMP87]]
 ; CHECK-NEXT:    [[TMP89:%.*]] = icmp eq i129 [[TMP86]], 0
-; CHECK-NEXT:    br i1 [[TMP89]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
+; CHECK-NEXT:    br i1 [[TMP89]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]], !prof [[PROF1]]
 ; CHECK:       udiv-end:
 ; CHECK-NEXT:    [[TMP90:%.*]] = phi i129 [ [[TMP67]], [[UDIV_LOOP_EXIT]] ], [ [[TMP62]], [[UDIV_END1]] ]
 ; CHECK-NEXT:    [[TMP91:%.*]] = mul i129 [[TMP50]], [[TMP90]]
@@ -534,3 +534,9 @@ define <vscale x 2 x i129> @sdiv129_scalable(<vscale x 2 x i129> %a, <vscale x 2
   %res = sdiv <vscale x 2 x i129> %a, %b
   ret <vscale x 2 x i129> %res
 }
+
+!0 = !{!"function_entry_count", i64 1000}
+;.
+; CHECK: [[PROF0]] = !{!"function_entry_count", i64 1000}
+; CHECK: [[PROF1]] = !{!"branch_weights", i32 1, i32 1048575}
+;.
diff --git a/llvm/utils/profcheck-xfail.txt b/llvm/utils/profcheck-xfail.txt
index 6c4ad00f4650c..f7c128cd44fe5 100644
--- a/llvm/utils/profcheck-xfail.txt
+++ b/llvm/utils/profcheck-xfail.txt
@@ -134,15 +134,7 @@ Transforms/CorrelatedValuePropagation/urem.ll
 Transforms/CrossDSOCFI/basic.ll
 Transforms/CrossDSOCFI/cfi_functions.ll
 Transforms/CrossDSOCFI/thumb.ll
-Transforms/ExpandIRInsts/X86/sdiv129.ll
-Transforms/ExpandIRInsts/X86/srem129.ll
-Transforms/ExpandIRInsts/X86/udiv129.ll
-Transforms/ExpandIRInsts/X86/urem129.ll
-Transforms/ExpandIRInsts/X86/vector.ll
-Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptosi129.ll
-Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptoui129.ll
-Transforms/ExpandIRInsts/X86/expand-large-fp-convert-si129tofp.ll
-Transforms/ExpandIRInsts/X86/expand-large-fp-convert-ui129tofp.ll
+
 Transforms/FixIrreducible/basic.ll
 Transforms/FixIrreducible/bug45623.ll
 Transforms/FixIrreducible/callbr.ll



More information about the llvm-commits mailing list