[llvm] cb5ebfa - [NFC] Cleanup: Remove instances of Function::getBasicBlockList()
Vasileios Porpodas via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 15 13:14:03 PST 2022
Author: Vasileios Porpodas
Date: 2022-12-15T13:08:25-08:00
New Revision: cb5ebfa2824b58ea28f431d529a8c0f0eb1cfb5e
URL: https://github.com/llvm/llvm-project/commit/cb5ebfa2824b58ea28f431d529a8c0f0eb1cfb5e
DIFF: https://github.com/llvm/llvm-project/commit/cb5ebfa2824b58ea28f431d529a8c0f0eb1cfb5e.diff
LOG: [NFC] Cleanup: Remove instances of Function::getBasicBlockList()
This is part of a series of patches that aim at making Function::getBasicBlockList() private.
Differential Revision: https://reviews.llvm.org/D140121
Added:
Modified:
llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp
llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp
llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp
llvm/examples/Kaleidoscope/MCJIT/initial/toy.cpp
llvm/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp
llvm/examples/Kaleidoscope/MCJIT/lazy/toy.cpp
llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp b/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp
index 3f3b133703b19..ed1262b59064b 100644
--- a/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp
+++ b/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp
@@ -763,7 +763,7 @@ Value *IfExprAST::Codegen() {
ThenBB = Builder.GetInsertBlock();
// Emit else block.
- TheFunction->getBasicBlockList().push_back(ElseBB);
+ TheFunction->insert(TheFunction->end(), ElseBB);
Builder.SetInsertPoint(ElseBB);
Value *ElseV = Else->Codegen();
@@ -774,7 +774,7 @@ Value *IfExprAST::Codegen() {
ElseBB = Builder.GetInsertBlock();
// Emit merge block.
- TheFunction->getBasicBlockList().push_back(MergeBB);
+ TheFunction->insert(TheFunction->end(), MergeBB);
Builder.SetInsertPoint(MergeBB);
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp");
diff --git a/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp b/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp
index 90e056d2132e2..09cd033f9ab29 100644
--- a/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp
+++ b/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp
@@ -1127,7 +1127,7 @@ Value *IfExprAST::Codegen() {
ThenBB = Builder.GetInsertBlock();
// Emit else block.
- TheFunction->getBasicBlockList().push_back(ElseBB);
+ TheFunction->insert(TheFunction->end(), ElseBB);
Builder.SetInsertPoint(ElseBB);
Value *ElseV = Else->Codegen();
@@ -1138,7 +1138,7 @@ Value *IfExprAST::Codegen() {
ElseBB = Builder.GetInsertBlock();
// Emit merge block.
- TheFunction->getBasicBlockList().push_back(MergeBB);
+ TheFunction->insert(TheFunction->end(), MergeBB);
Builder.SetInsertPoint(MergeBB);
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp");
diff --git a/llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp b/llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp
index 98bdad1e99077..bc2267fe18293 100644
--- a/llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp
+++ b/llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp
@@ -1205,7 +1205,7 @@ Value *IfExprAST::Codegen() {
ThenBB = Builder.GetInsertBlock();
// Emit else block.
- TheFunction->getBasicBlockList().push_back(ElseBB);
+ TheFunction->insert(TheFunction->end(), ElseBB);
Builder.SetInsertPoint(ElseBB);
Value *ElseV = Else->Codegen();
@@ -1216,7 +1216,7 @@ Value *IfExprAST::Codegen() {
ElseBB = Builder.GetInsertBlock();
// Emit merge block.
- TheFunction->getBasicBlockList().push_back(MergeBB);
+ TheFunction->insert(TheFunction->end(), MergeBB);
Builder.SetInsertPoint(MergeBB);
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp");
diff --git a/llvm/examples/Kaleidoscope/MCJIT/initial/toy.cpp b/llvm/examples/Kaleidoscope/MCJIT/initial/toy.cpp
index 9b84fd443d657..16535057ed9ec 100644
--- a/llvm/examples/Kaleidoscope/MCJIT/initial/toy.cpp
+++ b/llvm/examples/Kaleidoscope/MCJIT/initial/toy.cpp
@@ -985,7 +985,7 @@ Value *IfExprAST::Codegen() {
ThenBB = Builder.GetInsertBlock();
// Emit else block.
- TheFunction->getBasicBlockList().push_back(ElseBB);
+ TheFunction->insert(TheFunction->end(), ElseBB);
Builder.SetInsertPoint(ElseBB);
Value *ElseV = Else->Codegen();
@@ -996,7 +996,7 @@ Value *IfExprAST::Codegen() {
ElseBB = Builder.GetInsertBlock();
// Emit merge block.
- TheFunction->getBasicBlockList().push_back(MergeBB);
+ TheFunction->insert(TheFunction->end(), MergeBB);
Builder.SetInsertPoint(MergeBB);
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp");
diff --git a/llvm/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp b/llvm/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp
index a271c2047e33f..b9147e933c53a 100644
--- a/llvm/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp
+++ b/llvm/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp
@@ -745,7 +745,7 @@ Value *IfExprAST::Codegen() {
ThenBB = Builder.GetInsertBlock();
// Emit else block.
- TheFunction->getBasicBlockList().push_back(ElseBB);
+ TheFunction->insert(TheFunction->end(), ElseBB);
Builder.SetInsertPoint(ElseBB);
Value *ElseV = Else->Codegen();
@@ -756,7 +756,7 @@ Value *IfExprAST::Codegen() {
ElseBB = Builder.GetInsertBlock();
// Emit merge block.
- TheFunction->getBasicBlockList().push_back(MergeBB);
+ TheFunction->insert(TheFunction->end(), MergeBB);
Builder.SetInsertPoint(MergeBB);
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp");
diff --git a/llvm/examples/Kaleidoscope/MCJIT/lazy/toy.cpp b/llvm/examples/Kaleidoscope/MCJIT/lazy/toy.cpp
index 3511f3ac93bfb..0a6254da70639 100644
--- a/llvm/examples/Kaleidoscope/MCJIT/lazy/toy.cpp
+++ b/llvm/examples/Kaleidoscope/MCJIT/lazy/toy.cpp
@@ -1025,7 +1025,7 @@ Value *IfExprAST::Codegen() {
ThenBB = Builder.GetInsertBlock();
// Emit else block.
- TheFunction->getBasicBlockList().push_back(ElseBB);
+ TheFunction->insert(TheFunction->end(), ElseBB);
Builder.SetInsertPoint(ElseBB);
Value *ElseV = Else->Codegen();
@@ -1036,7 +1036,7 @@ Value *IfExprAST::Codegen() {
ElseBB = Builder.GetInsertBlock();
// Emit merge block.
- TheFunction->getBasicBlockList().push_back(MergeBB);
+ TheFunction->insert(TheFunction->end(), MergeBB);
Builder.SetInsertPoint(MergeBB);
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp");
diff --git a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
index 4cb5f3988e918..37842b198de87 100644
--- a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
+++ b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
@@ -191,8 +191,7 @@ IRToNativeSizeLearning::getFunctionFeatures(Function &F,
FF[NamedFeatureIndex::IsLocal] = F.hasLocalLinkage();
FF[NamedFeatureIndex::IsLinkOnceODR] = F.hasLinkOnceODRLinkage();
FF[NamedFeatureIndex::IsLinkOnce] = F.hasLinkOnceLinkage();
- FF[NamedFeatureIndex::Blocks] =
- std::distance(F.getBasicBlockList().begin(), F.getBasicBlockList().end());
+ FF[NamedFeatureIndex::Blocks] = F.size();
auto &LI = FAM.getResult<LoopAnalysis>(F);
FF[NamedFeatureIndex::Loops] = std::distance(LI.begin(), LI.end());
for (auto &L : LI)
More information about the llvm-commits
mailing list