[llvm] ad7a5d4 - [CallBrPrepare] Prefer Function &F over Function &Fn

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 23:38:13 PST 2025


Author: Aiden Grossman
Date: 2025-11-22T07:37:20Z
New Revision: ad7a5d4e059741819baa1561bfd9bc98d29260f3

URL: https://github.com/llvm/llvm-project/commit/ad7a5d4e059741819baa1561bfd9bc98d29260f3
DIFF: https://github.com/llvm/llvm-project/commit/ad7a5d4e059741819baa1561bfd9bc98d29260f3.diff

LOG: [CallBrPrepare] Prefer Function &F over Function &Fn

Function &F is the more standard abbreviation (~4000 uses in llvm versus
~300 uses).

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/CallBrPrepare.h
    llvm/lib/CodeGen/CallBrPrepare.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/CallBrPrepare.h b/llvm/include/llvm/CodeGen/CallBrPrepare.h
index 989343b02d024..d44d30b0adc17 100644
--- a/llvm/include/llvm/CodeGen/CallBrPrepare.h
+++ b/llvm/include/llvm/CodeGen/CallBrPrepare.h
@@ -15,7 +15,7 @@ namespace llvm {
 
 class CallBrPreparePass : public PassInfoMixin<CallBrPreparePass> {
 public:
-  PreservedAnalyses run(Function &Fn, FunctionAnalysisManager &FAM);
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm

diff  --git a/llvm/lib/CodeGen/CallBrPrepare.cpp b/llvm/lib/CodeGen/CallBrPrepare.cpp
index b6fe0fa00f2b0..77a0d0b653871 100644
--- a/llvm/lib/CodeGen/CallBrPrepare.cpp
+++ b/llvm/lib/CodeGen/CallBrPrepare.cpp
@@ -59,7 +59,7 @@ static bool InsertIntrinsicCalls(ArrayRef<CallBrInst *> CBRs,
                                  DominatorTree &DT);
 static void UpdateSSA(DominatorTree &DT, CallBrInst *CBR, CallInst *Intrinsic,
                       SSAUpdater &SSAUpdate);
-static SmallVector<CallBrInst *, 2> FindCallBrs(Function &Fn);
+static SmallVector<CallBrInst *, 2> FindCallBrs(Function &F);
 
 namespace {
 
@@ -67,21 +67,21 @@ class CallBrPrepare : public FunctionPass {
 public:
   CallBrPrepare() : FunctionPass(ID) {}
   void getAnalysisUsage(AnalysisUsage &AU) const override;
-  bool runOnFunction(Function &Fn) override;
+  bool runOnFunction(Function &F) override;
   static char ID;
 };
 
 } // end anonymous namespace
 
-PreservedAnalyses CallBrPreparePass::run(Function &Fn,
+PreservedAnalyses CallBrPreparePass::run(Function &F,
                                          FunctionAnalysisManager &FAM) {
   bool Changed = false;
-  SmallVector<CallBrInst *, 2> CBRs = FindCallBrs(Fn);
+  SmallVector<CallBrInst *, 2> CBRs = FindCallBrs(F);
 
   if (CBRs.empty())
     return PreservedAnalyses::all();
 
-  auto &DT = FAM.getResult<DominatorTreeAnalysis>(Fn);
+  auto &DT = FAM.getResult<DominatorTreeAnalysis>(F);
 
   Changed |= SplitCriticalEdges(CBRs, DT);
   Changed |= InsertIntrinsicCalls(CBRs, DT);
@@ -106,9 +106,9 @@ void CallBrPrepare::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addPreserved<DominatorTreeWrapperPass>();
 }
 
-SmallVector<CallBrInst *, 2> FindCallBrs(Function &Fn) {
+SmallVector<CallBrInst *, 2> FindCallBrs(Function &F) {
   SmallVector<CallBrInst *, 2> CBRs;
-  for (BasicBlock &BB : Fn)
+  for (BasicBlock &BB : F)
     if (auto *CBR = dyn_cast<CallBrInst>(BB.getTerminator()))
       if (!CBR->getType()->isVoidTy() && !CBR->use_empty())
         CBRs.push_back(CBR);
@@ -219,9 +219,9 @@ void UpdateSSA(DominatorTree &DT, CallBrInst *CBR, CallInst *Intrinsic,
   }
 }
 
-bool CallBrPrepare::runOnFunction(Function &Fn) {
+bool CallBrPrepare::runOnFunction(Function &F) {
   bool Changed = false;
-  SmallVector<CallBrInst *, 2> CBRs = FindCallBrs(Fn);
+  SmallVector<CallBrInst *, 2> CBRs = FindCallBrs(F);
 
   if (CBRs.empty())
     return Changed;
@@ -238,7 +238,7 @@ bool CallBrPrepare::runOnFunction(Function &Fn) {
   if (auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>())
     DT = &DTWP->getDomTree();
   else {
-    LazilyComputedDomTree.emplace(Fn);
+    LazilyComputedDomTree.emplace(F);
     DT = &*LazilyComputedDomTree;
   }
 


        


More information about the llvm-commits mailing list