[llvm] [Transforms][NFC] Remove second CodeExtractor constructor (PR #103399)
Alexis Engelke via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 12:38:11 PDT 2024
https://github.com/aengelke created https://github.com/llvm/llvm-project/pull/103399
This only has a single use and is equally well served by the existing
constructor -- blocks of a loop are already an array.
>From 487decdd070d009e78de3f1e0d196361b50c6c12 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Tue, 13 Aug 2024 19:37:58 +0000
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.5-bogner
---
llvm/include/llvm/Transforms/Utils/CodeExtractor.h | 11 -----------
llvm/lib/Transforms/IPO/LoopExtractor.cpp | 2 +-
llvm/lib/Transforms/Utils/CodeExtractor.cpp | 12 ------------
3 files changed, 1 insertion(+), 24 deletions(-)
diff --git a/llvm/include/llvm/Transforms/Utils/CodeExtractor.h b/llvm/include/llvm/Transforms/Utils/CodeExtractor.h
index 333ed6774d6c7e..68eb00a50fe030 100644
--- a/llvm/include/llvm/Transforms/Utils/CodeExtractor.h
+++ b/llvm/include/llvm/Transforms/Utils/CodeExtractor.h
@@ -32,7 +32,6 @@ class CallInst;
class DominatorTree;
class Function;
class Instruction;
-class Loop;
class Module;
class Type;
class Value;
@@ -143,16 +142,6 @@ class CodeExtractorAnalysisCache {
BasicBlock *AllocationBlock = nullptr,
std::string Suffix = "", bool ArgsInZeroAddressSpace = false);
- /// Create a code extractor for a loop body.
- ///
- /// Behaves just like the generic code sequence constructor, but uses the
- /// block sequence of the loop.
- CodeExtractor(DominatorTree &DT, Loop &L, bool AggregateArgs = false,
- BlockFrequencyInfo *BFI = nullptr,
- BranchProbabilityInfo *BPI = nullptr,
- AssumptionCache *AC = nullptr,
- std::string Suffix = "");
-
/// Perform the extraction, returning the new function.
///
/// Returns zero when called on a CodeExtractor instance where isEligible
diff --git a/llvm/lib/Transforms/IPO/LoopExtractor.cpp b/llvm/lib/Transforms/IPO/LoopExtractor.cpp
index 9a5876f85ba7f7..24b3c425180767 100644
--- a/llvm/lib/Transforms/IPO/LoopExtractor.cpp
+++ b/llvm/lib/Transforms/IPO/LoopExtractor.cpp
@@ -241,7 +241,7 @@ bool LoopExtractor::extractLoop(Loop *L, LoopInfo &LI, DominatorTree &DT) {
Function &Func = *L->getHeader()->getParent();
AssumptionCache *AC = LookupAssumptionCache(Func);
CodeExtractorAnalysisCache CEAC(Func);
- CodeExtractor Extractor(DT, *L, false, nullptr, nullptr, AC);
+ CodeExtractor Extractor(L->getBlocks(), &DT, false, nullptr, nullptr, AC);
if (Extractor.extractCodeRegion(CEAC)) {
LI.erase(L);
--NumLoops;
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
index 94c7f161fc4c73..81d3243c887fce 100644
--- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -23,7 +23,6 @@
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BlockFrequencyInfoImpl.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
-#include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
@@ -253,17 +252,6 @@ CodeExtractor::CodeExtractor(ArrayRef<BasicBlock *> BBs, DominatorTree *DT,
Blocks(buildExtractionBlockSet(BBs, DT, AllowVarArgs, AllowAlloca)),
Suffix(Suffix), ArgsInZeroAddressSpace(ArgsInZeroAddressSpace) {}
-CodeExtractor::CodeExtractor(DominatorTree &DT, Loop &L, bool AggregateArgs,
- BlockFrequencyInfo *BFI,
- BranchProbabilityInfo *BPI, AssumptionCache *AC,
- std::string Suffix)
- : DT(&DT), AggregateArgs(AggregateArgs || AggregateArgsOpt), BFI(BFI),
- BPI(BPI), AC(AC), AllocationBlock(nullptr), AllowVarArgs(false),
- Blocks(buildExtractionBlockSet(L.getBlocks(), &DT,
- /* AllowVarArgs */ false,
- /* AllowAlloca */ false)),
- Suffix(Suffix) {}
-
/// definedInRegion - Return true if the specified value is defined in the
/// extracted region.
static bool definedInRegion(const SetVector<BasicBlock *> &Blocks, Value *V) {
More information about the llvm-commits
mailing list