-
Notifications
You must be signed in to change notification settings - Fork 14.3k
TargetLibraryInfo: Delete default TargetLibraryInfoImpl constructor #145826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TargetLibraryInfo: Delete default TargetLibraryInfoImpl constructor #145826
Conversation
It should not be possible to construct one without a triple. It would also be nice to delete TargetLibraryInfoWrapperPass, but that is more difficult.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-llvm-analysis Author: Matt Arsenault (arsenm) ChangesIt should not be possible to construct one without a triple. It would Patch is 27.93 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/145826.diff 29 Files Affected:
diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
index 0596ff86b473e..58ffac0a6e207 100644
--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
@@ -136,7 +136,7 @@ class TargetLibraryInfoImpl {
AMDLIBM // AMD Math Vector library.
};
- LLVM_ABI TargetLibraryInfoImpl();
+ LLVM_ABI TargetLibraryInfoImpl() = delete;
LLVM_ABI explicit TargetLibraryInfoImpl(const Triple &T);
// Provide value semantics.
@@ -294,6 +294,8 @@ class TargetLibraryInfo {
std::bitset<NumLibFuncs> OverrideAsUnavailable;
public:
+ TargetLibraryInfo() = delete;
+
explicit TargetLibraryInfo(const TargetLibraryInfoImpl &Impl,
std::optional<const Function *> F = std::nullopt)
: Impl(&Impl) {
@@ -649,7 +651,11 @@ class LLVM_ABI TargetLibraryInfoWrapperPass : public ImmutablePass {
public:
static char ID;
+
+ /// The default constructor should not be used and is only for pass manager
+ /// initialization purposes.
TargetLibraryInfoWrapperPass();
+
explicit TargetLibraryInfoWrapperPass(const Triple &T);
explicit TargetLibraryInfoWrapperPass(const TargetLibraryInfoImpl &TLI);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index 5965be676ea69..bae7f0da7022c 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -47,6 +47,10 @@
#include "llvm/Transforms/Vectorize/LoadStoreVectorizer.h"
#include <cstdlib>
+namespace llvm {
+class Triple;
+}
+
namespace {
struct ForcePassLinking {
ForcePassLinking() {
@@ -147,7 +151,7 @@ struct ForcePassLinking {
llvm::Function::Create(nullptr, llvm::GlobalValue::ExternalLinkage)
->viewCFGOnly();
llvm::RGPassManager RGM;
- llvm::TargetLibraryInfoImpl TLII;
+ llvm::TargetLibraryInfoImpl TLII((llvm::Triple()));
llvm::TargetLibraryInfo TLI(TLII);
llvm::AliasAnalysis AA(TLI);
llvm::BatchAAResults BAA(AA);
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 28a5cdb5561dd..973c9b1d30ca1 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -929,12 +929,6 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
initializeLibCalls(TLI, T, StandardNames);
}
-TargetLibraryInfoImpl::TargetLibraryInfoImpl() {
- // Default to nothing being available.
- memset(AvailableArray, 0, sizeof(AvailableArray));
- initializeBase(*this, Triple());
-}
-
TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T) {
// Default to everything being available.
memset(AvailableArray, -1, sizeof(AvailableArray));
@@ -1499,7 +1493,7 @@ unsigned TargetLibraryInfoImpl::getSizeTSize(const Module &M) const {
}
TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass()
- : ImmutablePass(ID), TLA(TargetLibraryInfoImpl()) {}
+ : ImmutablePass(ID), TLA(TargetLibraryInfoImpl(Triple())) {}
TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass(const Triple &T)
: ImmutablePass(ID), TLA(TargetLibraryInfoImpl(T)) {}
diff --git a/llvm/unittests/Analysis/AliasAnalysisTest.cpp b/llvm/unittests/Analysis/AliasAnalysisTest.cpp
index 5d990521d4839..06066b1b92c51 100644
--- a/llvm/unittests/Analysis/AliasAnalysisTest.cpp
+++ b/llvm/unittests/Analysis/AliasAnalysisTest.cpp
@@ -147,7 +147,8 @@ class AliasAnalysisTest : public testing::Test {
std::unique_ptr<BasicAAResult> BAR;
std::unique_ptr<AAResults> AAR;
- AliasAnalysisTest() : M("AliasAnalysisTest", C), TLI(TLII) {}
+ AliasAnalysisTest()
+ : M("AliasAnalysisTest", C), TLII(M.getTargetTriple()), TLI(TLII) {}
AAResults &getAAResults(Function &F) {
// Reset the Function AA results first to clear out any references.
diff --git a/llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp b/llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp
index f5c73ff63934e..bae1f1c508af3 100644
--- a/llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp
+++ b/llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp
@@ -66,7 +66,8 @@ class BasicAATest : public testing::Test {
public:
BasicAATest()
- : M("BasicAATest", C), B(C), DL(DLString), TLI(TLII), F(nullptr) {}
+ : M("BasicAATest", C), B(C), DL(DLString), TLII(M.getTargetTriple()),
+ TLI(TLII), F(nullptr) {}
};
// Check that a function arg can't trivially alias a global when we're accessing
diff --git a/llvm/unittests/Analysis/DDGTest.cpp b/llvm/unittests/Analysis/DDGTest.cpp
index da6f53fb0141c..7fcdfdb62da43 100644
--- a/llvm/unittests/Analysis/DDGTest.cpp
+++ b/llvm/unittests/Analysis/DDGTest.cpp
@@ -29,7 +29,7 @@ static void runTest(Module &M, StringRef FuncName,
auto *F = M.getFunction(FuncName);
ASSERT_NE(F, nullptr) << "Could not find " << FuncName;
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M.getTargetTriple());
TargetLibraryInfo TLI(TLII);
AssumptionCache AC(*F);
DominatorTree DT(*F);
diff --git a/llvm/unittests/Analysis/IVDescriptorsTest.cpp b/llvm/unittests/Analysis/IVDescriptorsTest.cpp
index ce9383d15f461..453800abf9cab 100644
--- a/llvm/unittests/Analysis/IVDescriptorsTest.cpp
+++ b/llvm/unittests/Analysis/IVDescriptorsTest.cpp
@@ -26,7 +26,7 @@ static void runWithLoopInfoAndSE(
auto *F = M.getFunction(FuncName);
ASSERT_NE(F, nullptr) << "Could not find " << FuncName;
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M.getTargetTriple());
TargetLibraryInfo TLI(TLII);
AssumptionCache AC(*F);
DominatorTree DT(*F);
diff --git a/llvm/unittests/Analysis/LoadsTest.cpp b/llvm/unittests/Analysis/LoadsTest.cpp
index 13377a8082096..c4f5b22318e34 100644
--- a/llvm/unittests/Analysis/LoadsTest.cpp
+++ b/llvm/unittests/Analysis/LoadsTest.cpp
@@ -180,7 +180,7 @@ loop.end:
auto *F2 = dyn_cast<Function>(GV2);
ASSERT_TRUE(F1 && F2);
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M->getTargetTriple());
TargetLibraryInfo TLI(TLII);
auto IsDerefReadOnlyLoop = [&TLI](Function *F) -> bool {
diff --git a/llvm/unittests/Analysis/LoopInfoTest.cpp b/llvm/unittests/Analysis/LoopInfoTest.cpp
index 5e9edce049718..627e59d121c51 100644
--- a/llvm/unittests/Analysis/LoopInfoTest.cpp
+++ b/llvm/unittests/Analysis/LoopInfoTest.cpp
@@ -38,7 +38,7 @@ static void runWithLoopInfoPlus(
auto *F = M.getFunction(FuncName);
ASSERT_NE(F, nullptr) << "Could not find " << FuncName;
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M.getTargetTriple());
TargetLibraryInfo TLI(TLII);
AssumptionCache AC(*F);
DominatorTree DT(*F);
diff --git a/llvm/unittests/Analysis/LoopNestTest.cpp b/llvm/unittests/Analysis/LoopNestTest.cpp
index 366be2e872118..107ce85299f8f 100644
--- a/llvm/unittests/Analysis/LoopNestTest.cpp
+++ b/llvm/unittests/Analysis/LoopNestTest.cpp
@@ -25,7 +25,7 @@ static void runTest(
auto *F = M.getFunction(FuncName);
ASSERT_NE(F, nullptr) << "Could not find " << FuncName;
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M.getTargetTriple());
TargetLibraryInfo TLI(TLII);
AssumptionCache AC(*F);
DominatorTree DT(*F);
diff --git a/llvm/unittests/Analysis/MemorySSATest.cpp b/llvm/unittests/Analysis/MemorySSATest.cpp
index fda3a713b5761..a6f002b63dff1 100644
--- a/llvm/unittests/Analysis/MemorySSATest.cpp
+++ b/llvm/unittests/Analysis/MemorySSATest.cpp
@@ -70,7 +70,8 @@ class MemorySSATest : public testing::Test {
public:
MemorySSATest()
- : M("MemorySSATest", C), B(C), DL(DLString), TLI(TLII), F(nullptr) {}
+ : M("MemorySSATest", C), B(C), DL(DLString), TLII(M.getTargetTriple()),
+ TLI(TLII), F(nullptr) {}
};
TEST_F(MemorySSATest, CreateALoad) {
diff --git a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
index 95a4affdd7789..9b88e423e802b 100644
--- a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
+++ b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
@@ -39,7 +39,8 @@ class ScalarEvolutionsTest : public testing::Test {
std::unique_ptr<DominatorTree> DT;
std::unique_ptr<LoopInfo> LI;
- ScalarEvolutionsTest() : M("", Context), TLII(), TLI(TLII) {}
+ ScalarEvolutionsTest()
+ : M("", Context), TLII(M.getTargetTriple()), TLI(TLII) {}
ScalarEvolution buildSE(Function &F) {
AC.reset(new AssumptionCache(F));
diff --git a/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp b/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
index 2f1bcbae4fc50..b33419545efa8 100644
--- a/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
+++ b/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
@@ -26,7 +26,7 @@ class TargetLibraryInfoTest : public testing::Test {
std::unique_ptr<Module> M;
- TargetLibraryInfoTest() : TLI(TLII) {}
+ TargetLibraryInfoTest() : TLII(Triple()), TLI(TLII) {}
void parseAssembly(const char *Assembly) {
SMDiagnostic Error;
diff --git a/llvm/unittests/Analysis/UnrollAnalyzerTest.cpp b/llvm/unittests/Analysis/UnrollAnalyzerTest.cpp
index 0ff08d19957ef..d5ba1757ce35c 100644
--- a/llvm/unittests/Analysis/UnrollAnalyzerTest.cpp
+++ b/llvm/unittests/Analysis/UnrollAnalyzerTest.cpp
@@ -27,7 +27,7 @@ runUnrollAnalyzer(Module &M, StringRef FuncName,
auto *F = M.getFunction(FuncName);
ASSERT_NE(F, nullptr) << "Could not find " << FuncName;
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M.getTargetTriple());
TargetLibraryInfo TLI(TLII);
AssumptionCache AC(*F);
DominatorTree DT(*F);
diff --git a/llvm/unittests/SandboxIR/UtilsTest.cpp b/llvm/unittests/SandboxIR/UtilsTest.cpp
index a30fc253a1a74..2bef48616beb7 100644
--- a/llvm/unittests/SandboxIR/UtilsTest.cpp
+++ b/llvm/unittests/SandboxIR/UtilsTest.cpp
@@ -89,7 +89,7 @@ define void @foo(ptr %ptr) {
)IR");
llvm::Function &LLVMF = *M->getFunction("foo");
DominatorTree DT(LLVMF);
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M->getTargetTriple());
TargetLibraryInfo TLI(TLII);
DataLayout DL(M->getDataLayout());
AssumptionCache AC(LLVMF);
diff --git a/llvm/unittests/Transforms/Instrumentation/MemProfUseTest.cpp b/llvm/unittests/Transforms/Instrumentation/MemProfUseTest.cpp
index 0dd819a10e0b1..220dfedbee14a 100644
--- a/llvm/unittests/Transforms/Instrumentation/MemProfUseTest.cpp
+++ b/llvm/unittests/Transforms/Instrumentation/MemProfUseTest.cpp
@@ -91,7 +91,7 @@ declare !dbg !19 void @_Z2f3v()
auto *F = M->getFunction("_Z3foov");
ASSERT_NE(F, nullptr);
- TargetLibraryInfoWrapperPass WrapperPass;
+ TargetLibraryInfoWrapperPass WrapperPass(M->getTargetTriple());
auto &TLI = WrapperPass.getTLI(*F);
auto Calls = extractCallsFromIR(*M, TLI);
@@ -191,7 +191,7 @@ declare !dbg !25 void @_Z2g2v() local_unnamed_addr
auto *F = M->getFunction("_Z3foov");
ASSERT_NE(F, nullptr);
- TargetLibraryInfoWrapperPass WrapperPass;
+ TargetLibraryInfoWrapperPass WrapperPass(M->getTargetTriple());
auto &TLI = WrapperPass.getTLI(*F);
auto Calls = extractCallsFromIR(*M, TLI);
@@ -282,7 +282,7 @@ attributes #2 = { builtin allocsize(0) }
auto *F = M->getFunction("_Z3foov");
ASSERT_NE(F, nullptr);
- TargetLibraryInfoWrapperPass WrapperPass;
+ TargetLibraryInfoWrapperPass WrapperPass(M->getTargetTriple());
auto &TLI = WrapperPass.getTLI(*F);
auto Calls = extractCallsFromIR(*M, TLI);
@@ -398,7 +398,7 @@ attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "t
auto *F = M->getFunction("_Z3foov");
ASSERT_NE(F, nullptr);
- TargetLibraryInfoWrapperPass WrapperPass;
+ TargetLibraryInfoWrapperPass WrapperPass(M->getTargetTriple());
auto &TLI = WrapperPass.getTLI(*F);
auto Calls = extractCallsFromIR(*M, TLI);
diff --git a/llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp b/llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp
index e58daed887855..40a8c1d8d3da1 100644
--- a/llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp
+++ b/llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp
@@ -180,7 +180,7 @@ define i32 @foo(i32 %n) {
LoopInfo LI(DT);
DataLayout DL("e-i64:64-f80:128-n8:16:32:64-S128");
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M->getTargetTriple());
TargetLibraryInfo TLI(TLII);
AssumptionCache AC(*F);
AAResults AA(TLI);
@@ -255,7 +255,7 @@ declare void @sink_alt() cold
LoopInfo LI(DT);
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M->getTargetTriple());
TargetLibraryInfo TLI(TLII);
AAResults AA(TLI);
diff --git a/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp b/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp
index 9200fab436866..9466977d00649 100644
--- a/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp
+++ b/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp
@@ -38,7 +38,7 @@ static void run(Module &M, StringRef FuncName,
auto *F = M.getFunction(FuncName);
DominatorTree DT(*F);
PostDominatorTree PDT(*F);
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M.getTargetTriple());
TargetLibraryInfo TLI(TLII);
AssumptionCache AC(*F);
AliasAnalysis AA(TLI);
@@ -227,7 +227,7 @@ TEST(CodeMoverUtils, IsControlFlowEquivalentCondNestTest) {
// i = 2;
// }
std::unique_ptr<Module> M =
- parseIR(C, R"(define void @foo(i32* %i, i1 %cond1, i1 %cond2) {
+ parseIR(C, R"(define void @foo(i32* %i, i1 %cond1, i1 %cond2) {
entry:
br i1 %cond1, label %if.outer.first, label %if.first.end
if.outer.first:
@@ -282,8 +282,8 @@ TEST(CodeMoverUtils, IsControlFlowEquivalentImbalanceTest) {
// if (cond1)
// i = 4;
// }
- std::unique_ptr<Module> M = parseIR(
- C, R"(define void @foo(i32* %i, i1 %cond1, i1 %cond2, i1 %cond3) {
+ std::unique_ptr<Module> M =
+ parseIR(C, R"(define void @foo(i32* %i, i1 %cond1, i1 %cond2, i1 %cond3) {
entry:
br i1 %cond1, label %if.outer.first, label %if.first.end
if.outer.first:
diff --git a/llvm/unittests/Transforms/Utils/LoopRotationUtilsTest.cpp b/llvm/unittests/Transforms/Utils/LoopRotationUtilsTest.cpp
index c276f2ea62fed..70cdf0aba356c 100644
--- a/llvm/unittests/Transforms/Utils/LoopRotationUtilsTest.cpp
+++ b/llvm/unittests/Transforms/Utils/LoopRotationUtilsTest.cpp
@@ -79,7 +79,7 @@ deopt.exit:
LoopInfo LI(DT);
AssumptionCache AC(*F);
TargetTransformInfo TTI(M->getDataLayout());
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M->getTargetTriple());
TargetLibraryInfo TLI(TLII);
ScalarEvolution SE(*F, TLI, AC, DT, LI);
SimplifyQuery SQ(M->getDataLayout());
@@ -150,7 +150,7 @@ deopt.exit:
LoopInfo LI(DT);
AssumptionCache AC(*F);
TargetTransformInfo TTI(M->getDataLayout());
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M->getTargetTriple());
TargetLibraryInfo TLI(TLII);
ScalarEvolution SE(*F, TLI, AC, DT, LI);
SimplifyQuery SQ(M->getDataLayout());
diff --git a/llvm/unittests/Transforms/Utils/LoopUtilsTest.cpp b/llvm/unittests/Transforms/Utils/LoopUtilsTest.cpp
index cd4717181d2ca..c22a3582bee86 100644
--- a/llvm/unittests/Transforms/Utils/LoopUtilsTest.cpp
+++ b/llvm/unittests/Transforms/Utils/LoopUtilsTest.cpp
@@ -33,7 +33,7 @@ static void run(Module &M, StringRef FuncName,
Test) {
Function *F = M.getFunction(FuncName);
DominatorTree DT(*F);
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M.getTargetTriple());
TargetLibraryInfo TLI(TLII);
AssumptionCache AC(*F);
LoopInfo LI(DT);
diff --git a/llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp b/llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp
index 6aff8406790d3..55eae64fe0f6d 100644
--- a/llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp
+++ b/llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp
@@ -42,7 +42,8 @@ class ScalarEvolutionExpanderTest : public testing::Test {
std::unique_ptr<DominatorTree> DT;
std::unique_ptr<LoopInfo> LI;
- ScalarEvolutionExpanderTest() : M("", Context), TLII(), TLI(TLII) {}
+ ScalarEvolutionExpanderTest()
+ : M("", Context), TLII(M.getTargetTriple()), TLI(TLII) {}
ScalarEvolution buildSE(Function &F) {
AC.reset(new AssumptionCache(F));
diff --git a/llvm/unittests/Transforms/Utils/UnrollLoopTest.cpp b/llvm/unittests/Transforms/Utils/UnrollLoopTest.cpp
index fb02c89c77a10..eec10110e6af4 100644
--- a/llvm/unittests/Transforms/Utils/UnrollLoopTest.cpp
+++ b/llvm/unittests/Transforms/Utils/UnrollLoopTest.cpp
@@ -63,7 +63,7 @@ while.end: ; preds = %while.cond
DominatorTree DT(*F);
LoopInfo LI(DT);
AssumptionCache AC(*F);
- TargetLibraryInfoImpl TLII;
+ TargetLibraryInfoImpl TLII(M->getTargetTriple());
TargetLibraryInfo TLI(TLII);
ScalarEvolution SE(*F, TLI, AC, DT, LI);
diff --git a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/DependencyGraphTest.cpp b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/DependencyGraphTest.cpp
index 9a7ee8214d10a..721eda16c7e11 100644
--- a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/DependencyGraphTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/DependencyGraphTest.cpp
@@ -30,21 +30,26 @@ struct DependencyGraphTest : public testing::Test {
std::unique_ptr<DominatorTree> DT;
std::unique_ptr<BasicAAResult> BAA;
std::unique_ptr<AAResults> AA;
+ std::unique_ptr<TargetLibraryInfoImpl> TLII;
+ std::unique_ptr<TargetLibraryInfo> TLI;
void parseIR(LLVMContext &C, const char *IR) {
SMDiagnostic Err;
M = parseAssemblyString(IR, Err, C);
- if (!M)
+ if (!M) {
Err.print("DependencyGraphTest", errs());
+ return;
+ }
+
+ TLII = std::make_unique<TargetLibraryInfoImpl>(M->getTargetTriple());
+ TLI = std::make_unique<TargetLibraryInfo>(*TLII);
}
AAResults &getAA(llvm::Function &LLVMF) {
- TargetLibraryInfoImpl TLII;
- TargetLibraryInfo TLI(TLII);
- AA = std::make_unique<AAResults>(TLI);
+ AA = std::make_unique<AAResults>(*TLI);
AC = std::make_unique<AssumptionCache>(LLVMF);
DT = std::make_unique<DominatorTree>(LLVMF);
- BAA = std::make_unique<BasicAAResult>(M->getDataLayout(), LLVMF, TLI, *AC,
+ BAA = std::make_unique<BasicAAResult>(M->getDataLayout(), LLVMF, *TLI, *AC,
DT.get());
AA->addAAResult(*BAA);
return *AA;
diff --git a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/LegalityTest.cpp b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/LegalityTest.cpp
index 99519d17d0e8e..586f846caf267 100644
--- a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/LegalityTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/LegalityTest.cpp
@@ -38,8 +38,6 @@ struct LegalityTest : public testing::Test {
void getAnalyses(llvm::Function &LLVMF) {
DT = std::make_unique<DominatorTree>(LLVMF);
- TLII = std::make_unique<TargetLibraryInfoImpl>();
- TLI = std::make_unique<TargetLibraryInfo>(*TLII);
AC = std::make_unique<AssumptionCache>(LLVMF);
LI = std::make_unique<LoopInfo>(*DT);
SE = std::make_unique<ScalarEvolution>(LLVMF, *TLI, *AC, *DT, *LI);
@@ -52,8 +50,13 @@ struct LegalityTest : public testing::Test {
void parseIR(LLVMContext &C, const char *IR) {
SMDiagnostic Err;
M = parseAssemblyString(IR, Err, C);
- if (!M)
+ if (!M) {
Err.print("LegalityTest", errs());
+ return;
+ }
+
+ TLII = std::make_unique<TargetLibraryInfoImpl>(M->getTargetTriple());
+ TLI = std::make_unique<TargetLibraryInfo>(*TLII);
}
};
diff --git a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/SchedulerTest.cpp b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/SchedulerTest.cpp
index 6f6e8a089bacd..4c38fa069ba66 100644
--- a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/SchedulerTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/SchedulerTest.cpp
@@ -30,21 +30,26 @@ struct SchedulerTest : public testing::Test {
std::unique_ptr<DominatorTree> DT;
std::unique_ptr<BasicAAResult> BAA;
std::unique_ptr<AAResults> AA;
+ std::unique_ptr<TargetLibraryInfoImpl> TLII;
+ std::unique_ptr<TargetLibraryInfo> TLI;
void parseIR(LLVMContext &C, const char *IR) {
SMDiagnostic Err;
M = parseAssemblyString(IR, Err, C);
- if (!M)
+ if (!M) {
Err.print("SchedulerTest", errs())...
[truncated]
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
@@ -147,7 +151,7 @@ struct ForcePassLinking { | |||
llvm::Function::Create(nullptr, llvm::GlobalValue::ExternalLinkage) | |||
->viewCFGOnly(); | |||
llvm::RGPassManager RGM; | |||
llvm::TargetLibraryInfoImpl TLII; | |||
llvm::TargetLibraryInfoImpl TLII((llvm::Triple())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llvm::TargetLibraryInfoImpl TLII((llvm::Triple())); | |
llvm::TargetLibraryInfoImpl TLII(llvm::Triple()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
LinkAllPasses.h:154:38: note: add a pair of parentheses to declare a variable
error: no matching constructor for initialization of 'llvm::TargetLibraryInfo'
…lvm#145826) It should not be possible to construct one without a triple. It would also be nice to delete TargetLibraryInfoWrapperPass, but that is more difficult.
It should not be possible to construct one without a triple. It would
also be nice to delete TargetLibraryInfoWrapperPass, but that is more
difficult.