-
Notifications
You must be signed in to change notification settings - Fork 15.2k
RuntimeLibcalls: Move VectorLibrary handling into TargetOptions #167996
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
Conversation
Also add boilerplate to have a live instance when running opt configured from CommandFlags / TargetOptions.
Really this belongs in an IR module flag.
This fixes the -fveclib flag getting lost on its way to the backend. Previously this was its own cl::opt with a random boolean. Move the flag handling into CommandFlags with other backend ABI-ish options, and have clang directly set it, rather than forcing it to go through command line parsing. Prior to de68181, codegen used TargetLibraryInfo to find the vector function. Clang has special handling for TargetLibraryInfo, where it would directly construct one with the vector library in the pass pipeline. RuntimeLibcallsInfo currently is not used as an analysis in codegen, and needs to know the vector library when constructed. RuntimeLibraryAnalysis could follow the same trick that TargetLibraryInfo is using in the future, but a lot more boilerplate changes are needed to thread that analysis through codegen. Ideally this would come from an IR module flag, and nothing would be in TargetOptions. For now, it's better for all of these sorts of controls to be consistent.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
@llvm/pr-subscribers-llvm-ir Author: Matt Arsenault (arsenm) Changesclang: Pass -vector-library flag when using -fveclib Really this belongs in an IR module flag. RuntimeLibcalls: Move VectorLibrary handling into TargetOptions This fixes the -fveclib flag getting lost on its way to the backend. Previously this was its own cl::opt with a random boolean. Move the Prior to de68181, codegen used TargetLibraryInfo to find the vector RuntimeLibraryAnalysis could follow the same trick that TargetLibraryInfo is Full diff: https://github.com/llvm/llvm-project/pull/167996.diff 18 Files Affected:
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index b967a26dd19d7..f1e20403ad668 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -481,6 +481,36 @@ static bool initTargetOptions(const CompilerInstance &CI,
Options.JMCInstrument = CodeGenOpts.JMCInstrument;
Options.XCOFFReadOnlyPointers = CodeGenOpts.XCOFFReadOnlyPointers;
+ switch (CodeGenOpts.getVecLib()) {
+ case llvm::driver::VectorLibrary::NoLibrary:
+ Options.VectorLibrary = llvm::VectorLibrary::NoLibrary;
+ break;
+ case llvm::driver::VectorLibrary::Accelerate:
+ Options.VectorLibrary = llvm::VectorLibrary::Accelerate;
+ break;
+ case llvm::driver::VectorLibrary::Darwin_libsystem_m:
+ Options.VectorLibrary = llvm::VectorLibrary::DarwinLibSystemM;
+ break;
+ case llvm::driver::VectorLibrary::LIBMVEC:
+ Options.VectorLibrary = llvm::VectorLibrary::LIBMVEC;
+ break;
+ case llvm::driver::VectorLibrary::MASSV:
+ Options.VectorLibrary = llvm::VectorLibrary::MASSV;
+ break;
+ case llvm::driver::VectorLibrary::SVML:
+ Options.VectorLibrary = llvm::VectorLibrary::SVML;
+ break;
+ case llvm::driver::VectorLibrary::SLEEF:
+ Options.VectorLibrary = llvm::VectorLibrary::SLEEFGNUABI;
+ break;
+ case llvm::driver::VectorLibrary::ArmPL:
+ Options.VectorLibrary = llvm::VectorLibrary::ArmPL;
+ break;
+ case llvm::driver::VectorLibrary::AMDLIBM:
+ Options.VectorLibrary = llvm::VectorLibrary::AMDLIBM;
+ break;
+ }
+
switch (CodeGenOpts.getSwiftAsyncFramePointer()) {
case CodeGenOptions::SwiftAsyncFramePointerKind::Auto:
Options.SwiftAsyncFramePointer =
@@ -584,6 +614,7 @@ static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts,
BackendArgs.push_back("-limit-float-precision");
BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str());
}
+
// Check for the default "clang" invocation that won't set any cl::opt values.
// Skip trying to parse the command line invocation to avoid the issues
// described below.
diff --git a/cross-project-tests/CMakeLists.txt b/cross-project-tests/CMakeLists.txt
index 8e94579736537..3f932b8c7fd22 100644
--- a/cross-project-tests/CMakeLists.txt
+++ b/cross-project-tests/CMakeLists.txt
@@ -104,6 +104,13 @@ add_lit_testsuite(check-cross-dtlto "Running DTLTO cross-project tests"
DEPENDS ${CROSS_PROJECT_TEST_DEPS}
)
+# veclib tests.
+add_lit_testsuite(check-cross-veclib "Running veclib cross-project tests"
+ ${CMAKE_CURRENT_BINARY_DIR}/veclib
+ EXCLUDE_FROM_CHECK_ALL
+ DEPENDS ${CROSS_PROJECT_TEST_DEPS}
+ )
+
# Add check-cross-project-* targets.
add_lit_testsuites(CROSS_PROJECT ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${CROSS_PROJECT_TEST_DEPS}
diff --git a/cross-project-tests/veclib/lit.local.cfg b/cross-project-tests/veclib/lit.local.cfg
new file mode 100644
index 0000000000000..530f4c01646ff
--- /dev/null
+++ b/cross-project-tests/veclib/lit.local.cfg
@@ -0,0 +1,2 @@
+if "clang" not in config.available_features:
+ config.unsupported = True
diff --git a/cross-project-tests/veclib/veclib-sincos.c b/cross-project-tests/veclib/veclib-sincos.c
new file mode 100644
index 0000000000000..657d0df199522
--- /dev/null
+++ b/cross-project-tests/veclib/veclib-sincos.c
@@ -0,0 +1,21 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang -S -target aarch64-unknown-linux-gnu -O2 -fno-math-errno \
+// RUN: -fveclib=ArmPL -o - %s | FileCheck -check-prefix=ARMPL %s
+// RUN: %clang -S -target aarch64-unknown-linux-gnu -O2 -fno-math-errno \
+// RUN: -fveclib=SLEEF -o - %s | FileCheck -check-prefix=SLEEF %s
+
+typedef __SIZE_TYPE__ size_t;
+
+void sincos(double, double *, double *);
+
+// ARMPL: armpl_vsincosq_f64
+// ARMPL: armpl_vsincosq_f64
+
+// SLEEF: _ZGVnN2vl8l8_sincos
+// SLEEF: _ZGVnN2vl8l8_sincos
+void vectorize_sincos(double *restrict x, double *restrict s,
+ double *restrict c, size_t n) {
+ for (size_t i = 0; i < n; ++i) {
+ sincos(x[i], &s[i], &c[i]);
+ }
+}
diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
index 78954431e81c3..3b6cc0d1944fd 100644
--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
@@ -14,6 +14,7 @@
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/Pass.h"
#include "llvm/Support/Compiler.h"
#include "llvm/TargetParser/Triple.h"
@@ -23,7 +24,6 @@
namespace llvm {
template <typename T> class ArrayRef;
-enum class VectorLibrary;
/// Provides info so a possible vectorization of a function can be
/// computed. Function 'VectorFnName' is equivalent to 'ScalarFnName'
@@ -119,7 +119,8 @@ class TargetLibraryInfoImpl {
public:
TargetLibraryInfoImpl() = delete;
- LLVM_ABI explicit TargetLibraryInfoImpl(const Triple &T);
+ LLVM_ABI explicit TargetLibraryInfoImpl(
+ const Triple &T, VectorLibrary VecLib = VectorLibrary::NoLibrary);
// Provide value semantics.
LLVM_ABI TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI);
diff --git a/llvm/include/llvm/CodeGen/CommandFlags.h b/llvm/include/llvm/CodeGen/CommandFlags.h
index 59aacc75e055d..6a907b64542ae 100644
--- a/llvm/include/llvm/CodeGen/CommandFlags.h
+++ b/llvm/include/llvm/CodeGen/CommandFlags.h
@@ -125,6 +125,8 @@ LLVM_ABI llvm::EABI getEABIVersion();
LLVM_ABI llvm::DebuggerKind getDebuggerTuningOpt();
+LLVM_ABI llvm::VectorLibrary getVectorLibrary();
+
LLVM_ABI bool getEnableStackSizeSection();
LLVM_ABI bool getEnableAddrsig();
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 0afe32a4ecc3c..cf96547063cd0 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -23,6 +23,7 @@
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compiler.h"
@@ -83,7 +84,8 @@ struct RuntimeLibcallsInfo {
const Triple &TT,
ExceptionHandling ExceptionModel = ExceptionHandling::None,
FloatABI::ABIType FloatABI = FloatABI::Default,
- EABI EABIVersion = EABI::Default, StringRef ABIName = "");
+ EABI EABIVersion = EABI::Default, StringRef ABIName = "",
+ VectorLibrary VecLib = VectorLibrary::NoLibrary);
explicit RuntimeLibcallsInfo(const Module &M);
diff --git a/llvm/include/llvm/IR/SystemLibraries.h b/llvm/include/llvm/IR/SystemLibraries.h
index 1713b07c1c86f..5bdf67642e0e4 100644
--- a/llvm/include/llvm/IR/SystemLibraries.h
+++ b/llvm/include/llvm/IR/SystemLibraries.h
@@ -29,11 +29,6 @@ enum class VectorLibrary {
AMDLIBM // AMD Math Vector library.
};
-/// Command line flag value for the vector math library to use
-///
-/// FIXME: This should come from a module flag, and not be mutually exclusive
-extern VectorLibrary ClVectorLibrary;
-
} // namespace llvm
#endif // LLVM_IR_SYSTEMLIBRARIES_H
diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h
index bfd2817b8d1f5..b9258c0fee692 100644
--- a/llvm/include/llvm/Target/TargetOptions.h
+++ b/llvm/include/llvm/Target/TargetOptions.h
@@ -15,6 +15,7 @@
#define LLVM_TARGET_TARGETOPTIONS_H
#include "llvm/ADT/FloatingPointMode.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compiler.h"
@@ -409,6 +410,9 @@ class TargetOptions {
/// Which debugger to tune for.
DebuggerKind DebuggerTuning = DebuggerKind::Default;
+ /// Vector math library to use.
+ VectorLibrary VectorLibrary = VectorLibrary::NoLibrary;
+
private:
/// Flushing mode to assume in default FP environment.
DenormalMode FPDenormalMode;
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index f97abc9a32707..26d0c108fb03a 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -160,7 +160,8 @@ static void initializeBase(TargetLibraryInfoImpl &TLI, const Triple &T) {
/// target triple. This should be carefully written so that a missing target
/// triple gets a sane set of defaults.
static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
- ArrayRef<StringLiteral> StandardNames) {
+ ArrayRef<StringLiteral> StandardNames,
+ VectorLibrary VecLib) {
// Set IO unlocked variants as unavailable
// Set them as available per system below
TLI.setUnavailable(LibFunc_getc_unlocked);
@@ -924,23 +925,25 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
if (T.isOSAIX())
TLI.setUnavailable(LibFunc_memrchr);
- TLI.addVectorizableFunctionsFromVecLib(ClVectorLibrary, T);
+ TLI.addVectorizableFunctionsFromVecLib(VecLib, T);
}
/// Initialize the set of available library functions based on the specified
/// target triple. This should be carefully written so that a missing target
/// triple gets a sane set of defaults.
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
- ArrayRef<StringLiteral> StandardNames) {
+ ArrayRef<StringLiteral> StandardNames,
+ VectorLibrary VecLib) {
initializeBase(TLI, T);
- initializeLibCalls(TLI, T, StandardNames);
+ initializeLibCalls(TLI, T, StandardNames, VecLib);
}
-TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T) {
+TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T,
+ VectorLibrary VecLib) {
// Default to everything being available.
memset(AvailableArray, -1, sizeof(AvailableArray));
- initialize(*this, T, StandardNames);
+ initialize(*this, T, StandardNames, VecLib);
}
TargetLibraryInfoImpl::TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI)
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp
index cf225f1f03eac..02a6bb9357ad0 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -107,6 +107,7 @@ CGOPT(bool, UniqueBasicBlockSectionNames)
CGOPT(bool, SeparateNamedSections)
CGOPT(EABI, EABIVersion)
CGOPT(DebuggerKind, DebuggerTuningOpt)
+CGOPT(VectorLibrary, VectorLibrary)
CGOPT(bool, EnableStackSizeSection)
CGOPT(bool, EnableAddrsig)
CGOPT(bool, EnableCallGraphSection)
@@ -451,6 +452,28 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
clEnumValN(DebuggerKind::SCE, "sce", "SCE targets (e.g. PS4)")));
CGBINDOPT(DebuggerTuningOpt);
+ static cl::opt<VectorLibrary> VectorLibrary(
+ "vector-library", cl::Hidden, cl::desc("Vector functions library"),
+ cl::init(VectorLibrary::NoLibrary),
+ cl::values(
+ clEnumValN(VectorLibrary::NoLibrary, "none",
+ "No vector functions library"),
+ clEnumValN(VectorLibrary::Accelerate, "Accelerate",
+ "Accelerate framework"),
+ clEnumValN(VectorLibrary::DarwinLibSystemM, "Darwin_libsystem_m",
+ "Darwin libsystem_m"),
+ clEnumValN(VectorLibrary::LIBMVEC, "LIBMVEC",
+ "GLIBC Vector Math library"),
+ clEnumValN(VectorLibrary::MASSV, "MASSV", "IBM MASS vector library"),
+ clEnumValN(VectorLibrary::SVML, "SVML", "Intel SVML library"),
+ clEnumValN(VectorLibrary::SLEEFGNUABI, "sleefgnuabi",
+ "SIMD Library for Evaluating Elementary Functions"),
+ clEnumValN(VectorLibrary::ArmPL, "ArmPL",
+ "Arm Performance Libraries"),
+ clEnumValN(VectorLibrary::AMDLIBM, "AMDLIBM",
+ "AMD vector math library")));
+ CGBINDOPT(VectorLibrary);
+
static cl::opt<bool> EnableStackSizeSection(
"stack-size-section",
cl::desc("Emit a section containing stack size metadata"),
@@ -609,6 +632,7 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
Options.EnableTLSDESC =
getExplicitEnableTLSDESC().value_or(TheTriple.hasDefaultTLSDESC());
Options.ExceptionModel = getExceptionModel();
+ Options.VectorLibrary = getVectorLibrary();
Options.EmitStackSizeSection = getEnableStackSizeSection();
Options.EnableMachineFunctionSplitter = getEnableMachineFunctionSplitter();
Options.EnableStaticDataPartitioning = getEnableStaticDataPartitioning();
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 77d9b156e2672..0f1e37bbf1bfc 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -753,7 +753,8 @@ TargetLoweringBase::TargetLoweringBase(const TargetMachine &tm)
: TM(tm),
RuntimeLibcallInfo(TM.getTargetTriple(), TM.Options.ExceptionModel,
TM.Options.FloatABIType, TM.Options.EABIVersion,
- TM.Options.MCOptions.getABIName()),
+ TM.Options.MCOptions.getABIName(),
+ TM.Options.VectorLibrary),
Libcalls(RuntimeLibcallInfo) {
initActions();
diff --git a/llvm/lib/IR/CMakeLists.txt b/llvm/lib/IR/CMakeLists.txt
index ebdc2ca08d102..10572ff708bd3 100644
--- a/llvm/lib/IR/CMakeLists.txt
+++ b/llvm/lib/IR/CMakeLists.txt
@@ -67,7 +67,6 @@ add_llvm_component_library(LLVMCore
ReplaceConstant.cpp
Statepoint.cpp
StructuralHash.cpp
- SystemLibraries.cpp
Type.cpp
TypedPointerType.cpp
TypeFinder.cpp
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index ee23b58742b64..12d050329a302 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -29,7 +29,8 @@ using namespace RTLIB;
RuntimeLibcallsInfo::RuntimeLibcallsInfo(const Triple &TT,
ExceptionHandling ExceptionModel,
FloatABI::ABIType FloatABI,
- EABI EABIVersion, StringRef ABIName) {
+ EABI EABIVersion, StringRef ABIName,
+ VectorLibrary VecLib) {
// FIXME: The ExceptionModel parameter is to handle the field in
// TargetOptions. This interface fails to distinguish the forced disable
// case for targets which support exceptions by default. This should
@@ -40,7 +41,7 @@ RuntimeLibcallsInfo::RuntimeLibcallsInfo(const Triple &TT,
initLibcalls(TT, ExceptionModel, FloatABI, EABIVersion, ABIName);
// TODO: Tablegen should generate these sets
- switch (ClVectorLibrary) {
+ switch (VecLib) {
case VectorLibrary::SLEEFGNUABI:
for (RTLIB::LibcallImpl Impl :
{RTLIB::impl__ZGVnN2vl8_modf, RTLIB::impl__ZGVnN4vl4_modff,
diff --git a/llvm/lib/IR/SystemLibraries.cpp b/llvm/lib/IR/SystemLibraries.cpp
deleted file mode 100644
index fa4ac2adb7296..0000000000000
--- a/llvm/lib/IR/SystemLibraries.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//===-----------------------------------------------------------------------==//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/IR/SystemLibraries.h"
-#include "llvm/Support/CommandLine.h"
-
-using namespace llvm;
-
-VectorLibrary llvm::ClVectorLibrary;
-
-static cl::opt<VectorLibrary, true> ClVectorLibraryOpt(
- "vector-library", cl::Hidden, cl::desc("Vector functions library"),
- cl::location(llvm::ClVectorLibrary), cl::init(VectorLibrary::NoLibrary),
- cl::values(
- clEnumValN(VectorLibrary::NoLibrary, "none",
- "No vector functions library"),
- clEnumValN(VectorLibrary::Accelerate, "Accelerate",
- "Accelerate framework"),
- clEnumValN(VectorLibrary::DarwinLibSystemM, "Darwin_libsystem_m",
- "Darwin libsystem_m"),
- clEnumValN(VectorLibrary::LIBMVEC, "LIBMVEC",
- "GLIBC Vector Math library"),
- clEnumValN(VectorLibrary::MASSV, "MASSV", "IBM MASS vector library"),
- clEnumValN(VectorLibrary::SVML, "SVML", "Intel SVML library"),
- clEnumValN(VectorLibrary::SLEEFGNUABI, "sleefgnuabi",
- "SIMD Library for Evaluating Elementary Functions"),
- clEnumValN(VectorLibrary::ArmPL, "ArmPL", "Arm Performance Libraries"),
- clEnumValN(VectorLibrary::AMDLIBM, "AMDLIBM",
- "AMD vector math library")));
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 2147945d8a416..1cfedad15ec35 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -696,7 +696,8 @@ static int compileModule(char **argv, LLVMContext &Context,
}
// Add an appropriate TargetLibraryInfo pass for the module's triple.
- TargetLibraryInfoImpl TLII(M->getTargetTriple());
+ TargetLibraryInfoImpl TLII(M->getTargetTriple(),
+ Target->Options.VectorLibrary);
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (DisableSimplifyLibCalls)
diff --git a/llvm/tools/opt/optdriver.cpp b/llvm/tools/opt/optdriver.cpp
index 4cf117f227c00..d24c8abef31d0 100644
--- a/llvm/tools/opt/optdriver.cpp
+++ b/llvm/tools/opt/optdriver.cpp
@@ -670,13 +670,15 @@ optMain(int argc, char **argv,
M->addModuleFlag(Module::Error, "UnifiedLTO", 1);
}
+ VectorLibrary VecLib = codegen::getVectorLibrary();
// Add an appropriate TargetLibraryInfo pass for the module's triple.
- TargetLibraryInfoImpl TLII(ModuleTriple);
+ TargetLibraryInfoImpl TLII(ModuleTriple, VecLib);
- // FIXME: Get ABI name from MCOptions
RTLIB::RuntimeLibcallsInfo RTLCI(ModuleTriple, codegen::getExceptionModel(),
codegen::getFloatABIForCalls(),
- codegen::getEABIVersion());
+ codegen::getEABIVersion(),
+ "", // FIXME: Get ABI name from MCOptions
+ VecLib);
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (DisableSimplifyLibCalls)
diff --git a/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
index 8037c8d693cb8..22aa0b6418132 100644
--- a/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
@@ -82,7 +82,6 @@ static_library("IR") {
"SafepointIRVerifier.cpp",
"Statepoint.cpp",
"StructuralHash.cpp",
- "SystemLibraries.cpp",
"Type.cpp",
"TypeFinder.cpp",
"TypedPointerType.cpp",
|
|
@llvm/pr-subscribers-llvm-analysis Author: Matt Arsenault (arsenm) Changesclang: Pass -vector-library flag when using -fveclib Really this belongs in an IR module flag. RuntimeLibcalls: Move VectorLibrary handling into TargetOptions This fixes the -fveclib flag getting lost on its way to the backend. Previously this was its own cl::opt with a random boolean. Move the Prior to de68181, codegen used TargetLibraryInfo to find the vector RuntimeLibraryAnalysis could follow the same trick that TargetLibraryInfo is Full diff: https://github.com/llvm/llvm-project/pull/167996.diff 18 Files Affected:
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index b967a26dd19d7..f1e20403ad668 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -481,6 +481,36 @@ static bool initTargetOptions(const CompilerInstance &CI,
Options.JMCInstrument = CodeGenOpts.JMCInstrument;
Options.XCOFFReadOnlyPointers = CodeGenOpts.XCOFFReadOnlyPointers;
+ switch (CodeGenOpts.getVecLib()) {
+ case llvm::driver::VectorLibrary::NoLibrary:
+ Options.VectorLibrary = llvm::VectorLibrary::NoLibrary;
+ break;
+ case llvm::driver::VectorLibrary::Accelerate:
+ Options.VectorLibrary = llvm::VectorLibrary::Accelerate;
+ break;
+ case llvm::driver::VectorLibrary::Darwin_libsystem_m:
+ Options.VectorLibrary = llvm::VectorLibrary::DarwinLibSystemM;
+ break;
+ case llvm::driver::VectorLibrary::LIBMVEC:
+ Options.VectorLibrary = llvm::VectorLibrary::LIBMVEC;
+ break;
+ case llvm::driver::VectorLibrary::MASSV:
+ Options.VectorLibrary = llvm::VectorLibrary::MASSV;
+ break;
+ case llvm::driver::VectorLibrary::SVML:
+ Options.VectorLibrary = llvm::VectorLibrary::SVML;
+ break;
+ case llvm::driver::VectorLibrary::SLEEF:
+ Options.VectorLibrary = llvm::VectorLibrary::SLEEFGNUABI;
+ break;
+ case llvm::driver::VectorLibrary::ArmPL:
+ Options.VectorLibrary = llvm::VectorLibrary::ArmPL;
+ break;
+ case llvm::driver::VectorLibrary::AMDLIBM:
+ Options.VectorLibrary = llvm::VectorLibrary::AMDLIBM;
+ break;
+ }
+
switch (CodeGenOpts.getSwiftAsyncFramePointer()) {
case CodeGenOptions::SwiftAsyncFramePointerKind::Auto:
Options.SwiftAsyncFramePointer =
@@ -584,6 +614,7 @@ static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts,
BackendArgs.push_back("-limit-float-precision");
BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str());
}
+
// Check for the default "clang" invocation that won't set any cl::opt values.
// Skip trying to parse the command line invocation to avoid the issues
// described below.
diff --git a/cross-project-tests/CMakeLists.txt b/cross-project-tests/CMakeLists.txt
index 8e94579736537..3f932b8c7fd22 100644
--- a/cross-project-tests/CMakeLists.txt
+++ b/cross-project-tests/CMakeLists.txt
@@ -104,6 +104,13 @@ add_lit_testsuite(check-cross-dtlto "Running DTLTO cross-project tests"
DEPENDS ${CROSS_PROJECT_TEST_DEPS}
)
+# veclib tests.
+add_lit_testsuite(check-cross-veclib "Running veclib cross-project tests"
+ ${CMAKE_CURRENT_BINARY_DIR}/veclib
+ EXCLUDE_FROM_CHECK_ALL
+ DEPENDS ${CROSS_PROJECT_TEST_DEPS}
+ )
+
# Add check-cross-project-* targets.
add_lit_testsuites(CROSS_PROJECT ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${CROSS_PROJECT_TEST_DEPS}
diff --git a/cross-project-tests/veclib/lit.local.cfg b/cross-project-tests/veclib/lit.local.cfg
new file mode 100644
index 0000000000000..530f4c01646ff
--- /dev/null
+++ b/cross-project-tests/veclib/lit.local.cfg
@@ -0,0 +1,2 @@
+if "clang" not in config.available_features:
+ config.unsupported = True
diff --git a/cross-project-tests/veclib/veclib-sincos.c b/cross-project-tests/veclib/veclib-sincos.c
new file mode 100644
index 0000000000000..657d0df199522
--- /dev/null
+++ b/cross-project-tests/veclib/veclib-sincos.c
@@ -0,0 +1,21 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang -S -target aarch64-unknown-linux-gnu -O2 -fno-math-errno \
+// RUN: -fveclib=ArmPL -o - %s | FileCheck -check-prefix=ARMPL %s
+// RUN: %clang -S -target aarch64-unknown-linux-gnu -O2 -fno-math-errno \
+// RUN: -fveclib=SLEEF -o - %s | FileCheck -check-prefix=SLEEF %s
+
+typedef __SIZE_TYPE__ size_t;
+
+void sincos(double, double *, double *);
+
+// ARMPL: armpl_vsincosq_f64
+// ARMPL: armpl_vsincosq_f64
+
+// SLEEF: _ZGVnN2vl8l8_sincos
+// SLEEF: _ZGVnN2vl8l8_sincos
+void vectorize_sincos(double *restrict x, double *restrict s,
+ double *restrict c, size_t n) {
+ for (size_t i = 0; i < n; ++i) {
+ sincos(x[i], &s[i], &c[i]);
+ }
+}
diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
index 78954431e81c3..3b6cc0d1944fd 100644
--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
@@ -14,6 +14,7 @@
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/Pass.h"
#include "llvm/Support/Compiler.h"
#include "llvm/TargetParser/Triple.h"
@@ -23,7 +24,6 @@
namespace llvm {
template <typename T> class ArrayRef;
-enum class VectorLibrary;
/// Provides info so a possible vectorization of a function can be
/// computed. Function 'VectorFnName' is equivalent to 'ScalarFnName'
@@ -119,7 +119,8 @@ class TargetLibraryInfoImpl {
public:
TargetLibraryInfoImpl() = delete;
- LLVM_ABI explicit TargetLibraryInfoImpl(const Triple &T);
+ LLVM_ABI explicit TargetLibraryInfoImpl(
+ const Triple &T, VectorLibrary VecLib = VectorLibrary::NoLibrary);
// Provide value semantics.
LLVM_ABI TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI);
diff --git a/llvm/include/llvm/CodeGen/CommandFlags.h b/llvm/include/llvm/CodeGen/CommandFlags.h
index 59aacc75e055d..6a907b64542ae 100644
--- a/llvm/include/llvm/CodeGen/CommandFlags.h
+++ b/llvm/include/llvm/CodeGen/CommandFlags.h
@@ -125,6 +125,8 @@ LLVM_ABI llvm::EABI getEABIVersion();
LLVM_ABI llvm::DebuggerKind getDebuggerTuningOpt();
+LLVM_ABI llvm::VectorLibrary getVectorLibrary();
+
LLVM_ABI bool getEnableStackSizeSection();
LLVM_ABI bool getEnableAddrsig();
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 0afe32a4ecc3c..cf96547063cd0 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -23,6 +23,7 @@
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compiler.h"
@@ -83,7 +84,8 @@ struct RuntimeLibcallsInfo {
const Triple &TT,
ExceptionHandling ExceptionModel = ExceptionHandling::None,
FloatABI::ABIType FloatABI = FloatABI::Default,
- EABI EABIVersion = EABI::Default, StringRef ABIName = "");
+ EABI EABIVersion = EABI::Default, StringRef ABIName = "",
+ VectorLibrary VecLib = VectorLibrary::NoLibrary);
explicit RuntimeLibcallsInfo(const Module &M);
diff --git a/llvm/include/llvm/IR/SystemLibraries.h b/llvm/include/llvm/IR/SystemLibraries.h
index 1713b07c1c86f..5bdf67642e0e4 100644
--- a/llvm/include/llvm/IR/SystemLibraries.h
+++ b/llvm/include/llvm/IR/SystemLibraries.h
@@ -29,11 +29,6 @@ enum class VectorLibrary {
AMDLIBM // AMD Math Vector library.
};
-/// Command line flag value for the vector math library to use
-///
-/// FIXME: This should come from a module flag, and not be mutually exclusive
-extern VectorLibrary ClVectorLibrary;
-
} // namespace llvm
#endif // LLVM_IR_SYSTEMLIBRARIES_H
diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h
index bfd2817b8d1f5..b9258c0fee692 100644
--- a/llvm/include/llvm/Target/TargetOptions.h
+++ b/llvm/include/llvm/Target/TargetOptions.h
@@ -15,6 +15,7 @@
#define LLVM_TARGET_TARGETOPTIONS_H
#include "llvm/ADT/FloatingPointMode.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compiler.h"
@@ -409,6 +410,9 @@ class TargetOptions {
/// Which debugger to tune for.
DebuggerKind DebuggerTuning = DebuggerKind::Default;
+ /// Vector math library to use.
+ VectorLibrary VectorLibrary = VectorLibrary::NoLibrary;
+
private:
/// Flushing mode to assume in default FP environment.
DenormalMode FPDenormalMode;
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index f97abc9a32707..26d0c108fb03a 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -160,7 +160,8 @@ static void initializeBase(TargetLibraryInfoImpl &TLI, const Triple &T) {
/// target triple. This should be carefully written so that a missing target
/// triple gets a sane set of defaults.
static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
- ArrayRef<StringLiteral> StandardNames) {
+ ArrayRef<StringLiteral> StandardNames,
+ VectorLibrary VecLib) {
// Set IO unlocked variants as unavailable
// Set them as available per system below
TLI.setUnavailable(LibFunc_getc_unlocked);
@@ -924,23 +925,25 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
if (T.isOSAIX())
TLI.setUnavailable(LibFunc_memrchr);
- TLI.addVectorizableFunctionsFromVecLib(ClVectorLibrary, T);
+ TLI.addVectorizableFunctionsFromVecLib(VecLib, T);
}
/// Initialize the set of available library functions based on the specified
/// target triple. This should be carefully written so that a missing target
/// triple gets a sane set of defaults.
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
- ArrayRef<StringLiteral> StandardNames) {
+ ArrayRef<StringLiteral> StandardNames,
+ VectorLibrary VecLib) {
initializeBase(TLI, T);
- initializeLibCalls(TLI, T, StandardNames);
+ initializeLibCalls(TLI, T, StandardNames, VecLib);
}
-TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T) {
+TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T,
+ VectorLibrary VecLib) {
// Default to everything being available.
memset(AvailableArray, -1, sizeof(AvailableArray));
- initialize(*this, T, StandardNames);
+ initialize(*this, T, StandardNames, VecLib);
}
TargetLibraryInfoImpl::TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI)
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp
index cf225f1f03eac..02a6bb9357ad0 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -107,6 +107,7 @@ CGOPT(bool, UniqueBasicBlockSectionNames)
CGOPT(bool, SeparateNamedSections)
CGOPT(EABI, EABIVersion)
CGOPT(DebuggerKind, DebuggerTuningOpt)
+CGOPT(VectorLibrary, VectorLibrary)
CGOPT(bool, EnableStackSizeSection)
CGOPT(bool, EnableAddrsig)
CGOPT(bool, EnableCallGraphSection)
@@ -451,6 +452,28 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
clEnumValN(DebuggerKind::SCE, "sce", "SCE targets (e.g. PS4)")));
CGBINDOPT(DebuggerTuningOpt);
+ static cl::opt<VectorLibrary> VectorLibrary(
+ "vector-library", cl::Hidden, cl::desc("Vector functions library"),
+ cl::init(VectorLibrary::NoLibrary),
+ cl::values(
+ clEnumValN(VectorLibrary::NoLibrary, "none",
+ "No vector functions library"),
+ clEnumValN(VectorLibrary::Accelerate, "Accelerate",
+ "Accelerate framework"),
+ clEnumValN(VectorLibrary::DarwinLibSystemM, "Darwin_libsystem_m",
+ "Darwin libsystem_m"),
+ clEnumValN(VectorLibrary::LIBMVEC, "LIBMVEC",
+ "GLIBC Vector Math library"),
+ clEnumValN(VectorLibrary::MASSV, "MASSV", "IBM MASS vector library"),
+ clEnumValN(VectorLibrary::SVML, "SVML", "Intel SVML library"),
+ clEnumValN(VectorLibrary::SLEEFGNUABI, "sleefgnuabi",
+ "SIMD Library for Evaluating Elementary Functions"),
+ clEnumValN(VectorLibrary::ArmPL, "ArmPL",
+ "Arm Performance Libraries"),
+ clEnumValN(VectorLibrary::AMDLIBM, "AMDLIBM",
+ "AMD vector math library")));
+ CGBINDOPT(VectorLibrary);
+
static cl::opt<bool> EnableStackSizeSection(
"stack-size-section",
cl::desc("Emit a section containing stack size metadata"),
@@ -609,6 +632,7 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
Options.EnableTLSDESC =
getExplicitEnableTLSDESC().value_or(TheTriple.hasDefaultTLSDESC());
Options.ExceptionModel = getExceptionModel();
+ Options.VectorLibrary = getVectorLibrary();
Options.EmitStackSizeSection = getEnableStackSizeSection();
Options.EnableMachineFunctionSplitter = getEnableMachineFunctionSplitter();
Options.EnableStaticDataPartitioning = getEnableStaticDataPartitioning();
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 77d9b156e2672..0f1e37bbf1bfc 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -753,7 +753,8 @@ TargetLoweringBase::TargetLoweringBase(const TargetMachine &tm)
: TM(tm),
RuntimeLibcallInfo(TM.getTargetTriple(), TM.Options.ExceptionModel,
TM.Options.FloatABIType, TM.Options.EABIVersion,
- TM.Options.MCOptions.getABIName()),
+ TM.Options.MCOptions.getABIName(),
+ TM.Options.VectorLibrary),
Libcalls(RuntimeLibcallInfo) {
initActions();
diff --git a/llvm/lib/IR/CMakeLists.txt b/llvm/lib/IR/CMakeLists.txt
index ebdc2ca08d102..10572ff708bd3 100644
--- a/llvm/lib/IR/CMakeLists.txt
+++ b/llvm/lib/IR/CMakeLists.txt
@@ -67,7 +67,6 @@ add_llvm_component_library(LLVMCore
ReplaceConstant.cpp
Statepoint.cpp
StructuralHash.cpp
- SystemLibraries.cpp
Type.cpp
TypedPointerType.cpp
TypeFinder.cpp
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index ee23b58742b64..12d050329a302 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -29,7 +29,8 @@ using namespace RTLIB;
RuntimeLibcallsInfo::RuntimeLibcallsInfo(const Triple &TT,
ExceptionHandling ExceptionModel,
FloatABI::ABIType FloatABI,
- EABI EABIVersion, StringRef ABIName) {
+ EABI EABIVersion, StringRef ABIName,
+ VectorLibrary VecLib) {
// FIXME: The ExceptionModel parameter is to handle the field in
// TargetOptions. This interface fails to distinguish the forced disable
// case for targets which support exceptions by default. This should
@@ -40,7 +41,7 @@ RuntimeLibcallsInfo::RuntimeLibcallsInfo(const Triple &TT,
initLibcalls(TT, ExceptionModel, FloatABI, EABIVersion, ABIName);
// TODO: Tablegen should generate these sets
- switch (ClVectorLibrary) {
+ switch (VecLib) {
case VectorLibrary::SLEEFGNUABI:
for (RTLIB::LibcallImpl Impl :
{RTLIB::impl__ZGVnN2vl8_modf, RTLIB::impl__ZGVnN4vl4_modff,
diff --git a/llvm/lib/IR/SystemLibraries.cpp b/llvm/lib/IR/SystemLibraries.cpp
deleted file mode 100644
index fa4ac2adb7296..0000000000000
--- a/llvm/lib/IR/SystemLibraries.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//===-----------------------------------------------------------------------==//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/IR/SystemLibraries.h"
-#include "llvm/Support/CommandLine.h"
-
-using namespace llvm;
-
-VectorLibrary llvm::ClVectorLibrary;
-
-static cl::opt<VectorLibrary, true> ClVectorLibraryOpt(
- "vector-library", cl::Hidden, cl::desc("Vector functions library"),
- cl::location(llvm::ClVectorLibrary), cl::init(VectorLibrary::NoLibrary),
- cl::values(
- clEnumValN(VectorLibrary::NoLibrary, "none",
- "No vector functions library"),
- clEnumValN(VectorLibrary::Accelerate, "Accelerate",
- "Accelerate framework"),
- clEnumValN(VectorLibrary::DarwinLibSystemM, "Darwin_libsystem_m",
- "Darwin libsystem_m"),
- clEnumValN(VectorLibrary::LIBMVEC, "LIBMVEC",
- "GLIBC Vector Math library"),
- clEnumValN(VectorLibrary::MASSV, "MASSV", "IBM MASS vector library"),
- clEnumValN(VectorLibrary::SVML, "SVML", "Intel SVML library"),
- clEnumValN(VectorLibrary::SLEEFGNUABI, "sleefgnuabi",
- "SIMD Library for Evaluating Elementary Functions"),
- clEnumValN(VectorLibrary::ArmPL, "ArmPL", "Arm Performance Libraries"),
- clEnumValN(VectorLibrary::AMDLIBM, "AMDLIBM",
- "AMD vector math library")));
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 2147945d8a416..1cfedad15ec35 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -696,7 +696,8 @@ static int compileModule(char **argv, LLVMContext &Context,
}
// Add an appropriate TargetLibraryInfo pass for the module's triple.
- TargetLibraryInfoImpl TLII(M->getTargetTriple());
+ TargetLibraryInfoImpl TLII(M->getTargetTriple(),
+ Target->Options.VectorLibrary);
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (DisableSimplifyLibCalls)
diff --git a/llvm/tools/opt/optdriver.cpp b/llvm/tools/opt/optdriver.cpp
index 4cf117f227c00..d24c8abef31d0 100644
--- a/llvm/tools/opt/optdriver.cpp
+++ b/llvm/tools/opt/optdriver.cpp
@@ -670,13 +670,15 @@ optMain(int argc, char **argv,
M->addModuleFlag(Module::Error, "UnifiedLTO", 1);
}
+ VectorLibrary VecLib = codegen::getVectorLibrary();
// Add an appropriate TargetLibraryInfo pass for the module's triple.
- TargetLibraryInfoImpl TLII(ModuleTriple);
+ TargetLibraryInfoImpl TLII(ModuleTriple, VecLib);
- // FIXME: Get ABI name from MCOptions
RTLIB::RuntimeLibcallsInfo RTLCI(ModuleTriple, codegen::getExceptionModel(),
codegen::getFloatABIForCalls(),
- codegen::getEABIVersion());
+ codegen::getEABIVersion(),
+ "", // FIXME: Get ABI name from MCOptions
+ VecLib);
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (DisableSimplifyLibCalls)
diff --git a/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
index 8037c8d693cb8..22aa0b6418132 100644
--- a/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
@@ -82,7 +82,6 @@ static_library("IR") {
"SafepointIRVerifier.cpp",
"Statepoint.cpp",
"StructuralHash.cpp",
- "SystemLibraries.cpp",
"Type.cpp",
"TypeFinder.cpp",
"TypedPointerType.cpp",
|
|
@llvm/pr-subscribers-clang Author: Matt Arsenault (arsenm) Changesclang: Pass -vector-library flag when using -fveclib Really this belongs in an IR module flag. RuntimeLibcalls: Move VectorLibrary handling into TargetOptions This fixes the -fveclib flag getting lost on its way to the backend. Previously this was its own cl::opt with a random boolean. Move the Prior to de68181, codegen used TargetLibraryInfo to find the vector RuntimeLibraryAnalysis could follow the same trick that TargetLibraryInfo is Full diff: https://github.com/llvm/llvm-project/pull/167996.diff 18 Files Affected:
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index b967a26dd19d7..f1e20403ad668 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -481,6 +481,36 @@ static bool initTargetOptions(const CompilerInstance &CI,
Options.JMCInstrument = CodeGenOpts.JMCInstrument;
Options.XCOFFReadOnlyPointers = CodeGenOpts.XCOFFReadOnlyPointers;
+ switch (CodeGenOpts.getVecLib()) {
+ case llvm::driver::VectorLibrary::NoLibrary:
+ Options.VectorLibrary = llvm::VectorLibrary::NoLibrary;
+ break;
+ case llvm::driver::VectorLibrary::Accelerate:
+ Options.VectorLibrary = llvm::VectorLibrary::Accelerate;
+ break;
+ case llvm::driver::VectorLibrary::Darwin_libsystem_m:
+ Options.VectorLibrary = llvm::VectorLibrary::DarwinLibSystemM;
+ break;
+ case llvm::driver::VectorLibrary::LIBMVEC:
+ Options.VectorLibrary = llvm::VectorLibrary::LIBMVEC;
+ break;
+ case llvm::driver::VectorLibrary::MASSV:
+ Options.VectorLibrary = llvm::VectorLibrary::MASSV;
+ break;
+ case llvm::driver::VectorLibrary::SVML:
+ Options.VectorLibrary = llvm::VectorLibrary::SVML;
+ break;
+ case llvm::driver::VectorLibrary::SLEEF:
+ Options.VectorLibrary = llvm::VectorLibrary::SLEEFGNUABI;
+ break;
+ case llvm::driver::VectorLibrary::ArmPL:
+ Options.VectorLibrary = llvm::VectorLibrary::ArmPL;
+ break;
+ case llvm::driver::VectorLibrary::AMDLIBM:
+ Options.VectorLibrary = llvm::VectorLibrary::AMDLIBM;
+ break;
+ }
+
switch (CodeGenOpts.getSwiftAsyncFramePointer()) {
case CodeGenOptions::SwiftAsyncFramePointerKind::Auto:
Options.SwiftAsyncFramePointer =
@@ -584,6 +614,7 @@ static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts,
BackendArgs.push_back("-limit-float-precision");
BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str());
}
+
// Check for the default "clang" invocation that won't set any cl::opt values.
// Skip trying to parse the command line invocation to avoid the issues
// described below.
diff --git a/cross-project-tests/CMakeLists.txt b/cross-project-tests/CMakeLists.txt
index 8e94579736537..3f932b8c7fd22 100644
--- a/cross-project-tests/CMakeLists.txt
+++ b/cross-project-tests/CMakeLists.txt
@@ -104,6 +104,13 @@ add_lit_testsuite(check-cross-dtlto "Running DTLTO cross-project tests"
DEPENDS ${CROSS_PROJECT_TEST_DEPS}
)
+# veclib tests.
+add_lit_testsuite(check-cross-veclib "Running veclib cross-project tests"
+ ${CMAKE_CURRENT_BINARY_DIR}/veclib
+ EXCLUDE_FROM_CHECK_ALL
+ DEPENDS ${CROSS_PROJECT_TEST_DEPS}
+ )
+
# Add check-cross-project-* targets.
add_lit_testsuites(CROSS_PROJECT ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${CROSS_PROJECT_TEST_DEPS}
diff --git a/cross-project-tests/veclib/lit.local.cfg b/cross-project-tests/veclib/lit.local.cfg
new file mode 100644
index 0000000000000..530f4c01646ff
--- /dev/null
+++ b/cross-project-tests/veclib/lit.local.cfg
@@ -0,0 +1,2 @@
+if "clang" not in config.available_features:
+ config.unsupported = True
diff --git a/cross-project-tests/veclib/veclib-sincos.c b/cross-project-tests/veclib/veclib-sincos.c
new file mode 100644
index 0000000000000..657d0df199522
--- /dev/null
+++ b/cross-project-tests/veclib/veclib-sincos.c
@@ -0,0 +1,21 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang -S -target aarch64-unknown-linux-gnu -O2 -fno-math-errno \
+// RUN: -fveclib=ArmPL -o - %s | FileCheck -check-prefix=ARMPL %s
+// RUN: %clang -S -target aarch64-unknown-linux-gnu -O2 -fno-math-errno \
+// RUN: -fveclib=SLEEF -o - %s | FileCheck -check-prefix=SLEEF %s
+
+typedef __SIZE_TYPE__ size_t;
+
+void sincos(double, double *, double *);
+
+// ARMPL: armpl_vsincosq_f64
+// ARMPL: armpl_vsincosq_f64
+
+// SLEEF: _ZGVnN2vl8l8_sincos
+// SLEEF: _ZGVnN2vl8l8_sincos
+void vectorize_sincos(double *restrict x, double *restrict s,
+ double *restrict c, size_t n) {
+ for (size_t i = 0; i < n; ++i) {
+ sincos(x[i], &s[i], &c[i]);
+ }
+}
diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
index 78954431e81c3..3b6cc0d1944fd 100644
--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
@@ -14,6 +14,7 @@
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/Pass.h"
#include "llvm/Support/Compiler.h"
#include "llvm/TargetParser/Triple.h"
@@ -23,7 +24,6 @@
namespace llvm {
template <typename T> class ArrayRef;
-enum class VectorLibrary;
/// Provides info so a possible vectorization of a function can be
/// computed. Function 'VectorFnName' is equivalent to 'ScalarFnName'
@@ -119,7 +119,8 @@ class TargetLibraryInfoImpl {
public:
TargetLibraryInfoImpl() = delete;
- LLVM_ABI explicit TargetLibraryInfoImpl(const Triple &T);
+ LLVM_ABI explicit TargetLibraryInfoImpl(
+ const Triple &T, VectorLibrary VecLib = VectorLibrary::NoLibrary);
// Provide value semantics.
LLVM_ABI TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI);
diff --git a/llvm/include/llvm/CodeGen/CommandFlags.h b/llvm/include/llvm/CodeGen/CommandFlags.h
index 59aacc75e055d..6a907b64542ae 100644
--- a/llvm/include/llvm/CodeGen/CommandFlags.h
+++ b/llvm/include/llvm/CodeGen/CommandFlags.h
@@ -125,6 +125,8 @@ LLVM_ABI llvm::EABI getEABIVersion();
LLVM_ABI llvm::DebuggerKind getDebuggerTuningOpt();
+LLVM_ABI llvm::VectorLibrary getVectorLibrary();
+
LLVM_ABI bool getEnableStackSizeSection();
LLVM_ABI bool getEnableAddrsig();
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 0afe32a4ecc3c..cf96547063cd0 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -23,6 +23,7 @@
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compiler.h"
@@ -83,7 +84,8 @@ struct RuntimeLibcallsInfo {
const Triple &TT,
ExceptionHandling ExceptionModel = ExceptionHandling::None,
FloatABI::ABIType FloatABI = FloatABI::Default,
- EABI EABIVersion = EABI::Default, StringRef ABIName = "");
+ EABI EABIVersion = EABI::Default, StringRef ABIName = "",
+ VectorLibrary VecLib = VectorLibrary::NoLibrary);
explicit RuntimeLibcallsInfo(const Module &M);
diff --git a/llvm/include/llvm/IR/SystemLibraries.h b/llvm/include/llvm/IR/SystemLibraries.h
index 1713b07c1c86f..5bdf67642e0e4 100644
--- a/llvm/include/llvm/IR/SystemLibraries.h
+++ b/llvm/include/llvm/IR/SystemLibraries.h
@@ -29,11 +29,6 @@ enum class VectorLibrary {
AMDLIBM // AMD Math Vector library.
};
-/// Command line flag value for the vector math library to use
-///
-/// FIXME: This should come from a module flag, and not be mutually exclusive
-extern VectorLibrary ClVectorLibrary;
-
} // namespace llvm
#endif // LLVM_IR_SYSTEMLIBRARIES_H
diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h
index bfd2817b8d1f5..b9258c0fee692 100644
--- a/llvm/include/llvm/Target/TargetOptions.h
+++ b/llvm/include/llvm/Target/TargetOptions.h
@@ -15,6 +15,7 @@
#define LLVM_TARGET_TARGETOPTIONS_H
#include "llvm/ADT/FloatingPointMode.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compiler.h"
@@ -409,6 +410,9 @@ class TargetOptions {
/// Which debugger to tune for.
DebuggerKind DebuggerTuning = DebuggerKind::Default;
+ /// Vector math library to use.
+ VectorLibrary VectorLibrary = VectorLibrary::NoLibrary;
+
private:
/// Flushing mode to assume in default FP environment.
DenormalMode FPDenormalMode;
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index f97abc9a32707..26d0c108fb03a 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -160,7 +160,8 @@ static void initializeBase(TargetLibraryInfoImpl &TLI, const Triple &T) {
/// target triple. This should be carefully written so that a missing target
/// triple gets a sane set of defaults.
static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
- ArrayRef<StringLiteral> StandardNames) {
+ ArrayRef<StringLiteral> StandardNames,
+ VectorLibrary VecLib) {
// Set IO unlocked variants as unavailable
// Set them as available per system below
TLI.setUnavailable(LibFunc_getc_unlocked);
@@ -924,23 +925,25 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
if (T.isOSAIX())
TLI.setUnavailable(LibFunc_memrchr);
- TLI.addVectorizableFunctionsFromVecLib(ClVectorLibrary, T);
+ TLI.addVectorizableFunctionsFromVecLib(VecLib, T);
}
/// Initialize the set of available library functions based on the specified
/// target triple. This should be carefully written so that a missing target
/// triple gets a sane set of defaults.
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
- ArrayRef<StringLiteral> StandardNames) {
+ ArrayRef<StringLiteral> StandardNames,
+ VectorLibrary VecLib) {
initializeBase(TLI, T);
- initializeLibCalls(TLI, T, StandardNames);
+ initializeLibCalls(TLI, T, StandardNames, VecLib);
}
-TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T) {
+TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T,
+ VectorLibrary VecLib) {
// Default to everything being available.
memset(AvailableArray, -1, sizeof(AvailableArray));
- initialize(*this, T, StandardNames);
+ initialize(*this, T, StandardNames, VecLib);
}
TargetLibraryInfoImpl::TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI)
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp
index cf225f1f03eac..02a6bb9357ad0 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -107,6 +107,7 @@ CGOPT(bool, UniqueBasicBlockSectionNames)
CGOPT(bool, SeparateNamedSections)
CGOPT(EABI, EABIVersion)
CGOPT(DebuggerKind, DebuggerTuningOpt)
+CGOPT(VectorLibrary, VectorLibrary)
CGOPT(bool, EnableStackSizeSection)
CGOPT(bool, EnableAddrsig)
CGOPT(bool, EnableCallGraphSection)
@@ -451,6 +452,28 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
clEnumValN(DebuggerKind::SCE, "sce", "SCE targets (e.g. PS4)")));
CGBINDOPT(DebuggerTuningOpt);
+ static cl::opt<VectorLibrary> VectorLibrary(
+ "vector-library", cl::Hidden, cl::desc("Vector functions library"),
+ cl::init(VectorLibrary::NoLibrary),
+ cl::values(
+ clEnumValN(VectorLibrary::NoLibrary, "none",
+ "No vector functions library"),
+ clEnumValN(VectorLibrary::Accelerate, "Accelerate",
+ "Accelerate framework"),
+ clEnumValN(VectorLibrary::DarwinLibSystemM, "Darwin_libsystem_m",
+ "Darwin libsystem_m"),
+ clEnumValN(VectorLibrary::LIBMVEC, "LIBMVEC",
+ "GLIBC Vector Math library"),
+ clEnumValN(VectorLibrary::MASSV, "MASSV", "IBM MASS vector library"),
+ clEnumValN(VectorLibrary::SVML, "SVML", "Intel SVML library"),
+ clEnumValN(VectorLibrary::SLEEFGNUABI, "sleefgnuabi",
+ "SIMD Library for Evaluating Elementary Functions"),
+ clEnumValN(VectorLibrary::ArmPL, "ArmPL",
+ "Arm Performance Libraries"),
+ clEnumValN(VectorLibrary::AMDLIBM, "AMDLIBM",
+ "AMD vector math library")));
+ CGBINDOPT(VectorLibrary);
+
static cl::opt<bool> EnableStackSizeSection(
"stack-size-section",
cl::desc("Emit a section containing stack size metadata"),
@@ -609,6 +632,7 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
Options.EnableTLSDESC =
getExplicitEnableTLSDESC().value_or(TheTriple.hasDefaultTLSDESC());
Options.ExceptionModel = getExceptionModel();
+ Options.VectorLibrary = getVectorLibrary();
Options.EmitStackSizeSection = getEnableStackSizeSection();
Options.EnableMachineFunctionSplitter = getEnableMachineFunctionSplitter();
Options.EnableStaticDataPartitioning = getEnableStaticDataPartitioning();
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 77d9b156e2672..0f1e37bbf1bfc 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -753,7 +753,8 @@ TargetLoweringBase::TargetLoweringBase(const TargetMachine &tm)
: TM(tm),
RuntimeLibcallInfo(TM.getTargetTriple(), TM.Options.ExceptionModel,
TM.Options.FloatABIType, TM.Options.EABIVersion,
- TM.Options.MCOptions.getABIName()),
+ TM.Options.MCOptions.getABIName(),
+ TM.Options.VectorLibrary),
Libcalls(RuntimeLibcallInfo) {
initActions();
diff --git a/llvm/lib/IR/CMakeLists.txt b/llvm/lib/IR/CMakeLists.txt
index ebdc2ca08d102..10572ff708bd3 100644
--- a/llvm/lib/IR/CMakeLists.txt
+++ b/llvm/lib/IR/CMakeLists.txt
@@ -67,7 +67,6 @@ add_llvm_component_library(LLVMCore
ReplaceConstant.cpp
Statepoint.cpp
StructuralHash.cpp
- SystemLibraries.cpp
Type.cpp
TypedPointerType.cpp
TypeFinder.cpp
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index ee23b58742b64..12d050329a302 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -29,7 +29,8 @@ using namespace RTLIB;
RuntimeLibcallsInfo::RuntimeLibcallsInfo(const Triple &TT,
ExceptionHandling ExceptionModel,
FloatABI::ABIType FloatABI,
- EABI EABIVersion, StringRef ABIName) {
+ EABI EABIVersion, StringRef ABIName,
+ VectorLibrary VecLib) {
// FIXME: The ExceptionModel parameter is to handle the field in
// TargetOptions. This interface fails to distinguish the forced disable
// case for targets which support exceptions by default. This should
@@ -40,7 +41,7 @@ RuntimeLibcallsInfo::RuntimeLibcallsInfo(const Triple &TT,
initLibcalls(TT, ExceptionModel, FloatABI, EABIVersion, ABIName);
// TODO: Tablegen should generate these sets
- switch (ClVectorLibrary) {
+ switch (VecLib) {
case VectorLibrary::SLEEFGNUABI:
for (RTLIB::LibcallImpl Impl :
{RTLIB::impl__ZGVnN2vl8_modf, RTLIB::impl__ZGVnN4vl4_modff,
diff --git a/llvm/lib/IR/SystemLibraries.cpp b/llvm/lib/IR/SystemLibraries.cpp
deleted file mode 100644
index fa4ac2adb7296..0000000000000
--- a/llvm/lib/IR/SystemLibraries.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//===-----------------------------------------------------------------------==//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/IR/SystemLibraries.h"
-#include "llvm/Support/CommandLine.h"
-
-using namespace llvm;
-
-VectorLibrary llvm::ClVectorLibrary;
-
-static cl::opt<VectorLibrary, true> ClVectorLibraryOpt(
- "vector-library", cl::Hidden, cl::desc("Vector functions library"),
- cl::location(llvm::ClVectorLibrary), cl::init(VectorLibrary::NoLibrary),
- cl::values(
- clEnumValN(VectorLibrary::NoLibrary, "none",
- "No vector functions library"),
- clEnumValN(VectorLibrary::Accelerate, "Accelerate",
- "Accelerate framework"),
- clEnumValN(VectorLibrary::DarwinLibSystemM, "Darwin_libsystem_m",
- "Darwin libsystem_m"),
- clEnumValN(VectorLibrary::LIBMVEC, "LIBMVEC",
- "GLIBC Vector Math library"),
- clEnumValN(VectorLibrary::MASSV, "MASSV", "IBM MASS vector library"),
- clEnumValN(VectorLibrary::SVML, "SVML", "Intel SVML library"),
- clEnumValN(VectorLibrary::SLEEFGNUABI, "sleefgnuabi",
- "SIMD Library for Evaluating Elementary Functions"),
- clEnumValN(VectorLibrary::ArmPL, "ArmPL", "Arm Performance Libraries"),
- clEnumValN(VectorLibrary::AMDLIBM, "AMDLIBM",
- "AMD vector math library")));
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 2147945d8a416..1cfedad15ec35 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -696,7 +696,8 @@ static int compileModule(char **argv, LLVMContext &Context,
}
// Add an appropriate TargetLibraryInfo pass for the module's triple.
- TargetLibraryInfoImpl TLII(M->getTargetTriple());
+ TargetLibraryInfoImpl TLII(M->getTargetTriple(),
+ Target->Options.VectorLibrary);
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (DisableSimplifyLibCalls)
diff --git a/llvm/tools/opt/optdriver.cpp b/llvm/tools/opt/optdriver.cpp
index 4cf117f227c00..d24c8abef31d0 100644
--- a/llvm/tools/opt/optdriver.cpp
+++ b/llvm/tools/opt/optdriver.cpp
@@ -670,13 +670,15 @@ optMain(int argc, char **argv,
M->addModuleFlag(Module::Error, "UnifiedLTO", 1);
}
+ VectorLibrary VecLib = codegen::getVectorLibrary();
// Add an appropriate TargetLibraryInfo pass for the module's triple.
- TargetLibraryInfoImpl TLII(ModuleTriple);
+ TargetLibraryInfoImpl TLII(ModuleTriple, VecLib);
- // FIXME: Get ABI name from MCOptions
RTLIB::RuntimeLibcallsInfo RTLCI(ModuleTriple, codegen::getExceptionModel(),
codegen::getFloatABIForCalls(),
- codegen::getEABIVersion());
+ codegen::getEABIVersion(),
+ "", // FIXME: Get ABI name from MCOptions
+ VecLib);
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (DisableSimplifyLibCalls)
diff --git a/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
index 8037c8d693cb8..22aa0b6418132 100644
--- a/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
@@ -82,7 +82,6 @@ static_library("IR") {
"SafepointIRVerifier.cpp",
"Statepoint.cpp",
"StructuralHash.cpp",
- "SystemLibraries.cpp",
"Type.cpp",
"TypeFinder.cpp",
"TypedPointerType.cpp",
|
|
@llvm/pr-subscribers-clang-codegen Author: Matt Arsenault (arsenm) Changesclang: Pass -vector-library flag when using -fveclib Really this belongs in an IR module flag. RuntimeLibcalls: Move VectorLibrary handling into TargetOptions This fixes the -fveclib flag getting lost on its way to the backend. Previously this was its own cl::opt with a random boolean. Move the Prior to de68181, codegen used TargetLibraryInfo to find the vector RuntimeLibraryAnalysis could follow the same trick that TargetLibraryInfo is Full diff: https://github.com/llvm/llvm-project/pull/167996.diff 18 Files Affected:
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index b967a26dd19d7..f1e20403ad668 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -481,6 +481,36 @@ static bool initTargetOptions(const CompilerInstance &CI,
Options.JMCInstrument = CodeGenOpts.JMCInstrument;
Options.XCOFFReadOnlyPointers = CodeGenOpts.XCOFFReadOnlyPointers;
+ switch (CodeGenOpts.getVecLib()) {
+ case llvm::driver::VectorLibrary::NoLibrary:
+ Options.VectorLibrary = llvm::VectorLibrary::NoLibrary;
+ break;
+ case llvm::driver::VectorLibrary::Accelerate:
+ Options.VectorLibrary = llvm::VectorLibrary::Accelerate;
+ break;
+ case llvm::driver::VectorLibrary::Darwin_libsystem_m:
+ Options.VectorLibrary = llvm::VectorLibrary::DarwinLibSystemM;
+ break;
+ case llvm::driver::VectorLibrary::LIBMVEC:
+ Options.VectorLibrary = llvm::VectorLibrary::LIBMVEC;
+ break;
+ case llvm::driver::VectorLibrary::MASSV:
+ Options.VectorLibrary = llvm::VectorLibrary::MASSV;
+ break;
+ case llvm::driver::VectorLibrary::SVML:
+ Options.VectorLibrary = llvm::VectorLibrary::SVML;
+ break;
+ case llvm::driver::VectorLibrary::SLEEF:
+ Options.VectorLibrary = llvm::VectorLibrary::SLEEFGNUABI;
+ break;
+ case llvm::driver::VectorLibrary::ArmPL:
+ Options.VectorLibrary = llvm::VectorLibrary::ArmPL;
+ break;
+ case llvm::driver::VectorLibrary::AMDLIBM:
+ Options.VectorLibrary = llvm::VectorLibrary::AMDLIBM;
+ break;
+ }
+
switch (CodeGenOpts.getSwiftAsyncFramePointer()) {
case CodeGenOptions::SwiftAsyncFramePointerKind::Auto:
Options.SwiftAsyncFramePointer =
@@ -584,6 +614,7 @@ static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts,
BackendArgs.push_back("-limit-float-precision");
BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str());
}
+
// Check for the default "clang" invocation that won't set any cl::opt values.
// Skip trying to parse the command line invocation to avoid the issues
// described below.
diff --git a/cross-project-tests/CMakeLists.txt b/cross-project-tests/CMakeLists.txt
index 8e94579736537..3f932b8c7fd22 100644
--- a/cross-project-tests/CMakeLists.txt
+++ b/cross-project-tests/CMakeLists.txt
@@ -104,6 +104,13 @@ add_lit_testsuite(check-cross-dtlto "Running DTLTO cross-project tests"
DEPENDS ${CROSS_PROJECT_TEST_DEPS}
)
+# veclib tests.
+add_lit_testsuite(check-cross-veclib "Running veclib cross-project tests"
+ ${CMAKE_CURRENT_BINARY_DIR}/veclib
+ EXCLUDE_FROM_CHECK_ALL
+ DEPENDS ${CROSS_PROJECT_TEST_DEPS}
+ )
+
# Add check-cross-project-* targets.
add_lit_testsuites(CROSS_PROJECT ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${CROSS_PROJECT_TEST_DEPS}
diff --git a/cross-project-tests/veclib/lit.local.cfg b/cross-project-tests/veclib/lit.local.cfg
new file mode 100644
index 0000000000000..530f4c01646ff
--- /dev/null
+++ b/cross-project-tests/veclib/lit.local.cfg
@@ -0,0 +1,2 @@
+if "clang" not in config.available_features:
+ config.unsupported = True
diff --git a/cross-project-tests/veclib/veclib-sincos.c b/cross-project-tests/veclib/veclib-sincos.c
new file mode 100644
index 0000000000000..657d0df199522
--- /dev/null
+++ b/cross-project-tests/veclib/veclib-sincos.c
@@ -0,0 +1,21 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang -S -target aarch64-unknown-linux-gnu -O2 -fno-math-errno \
+// RUN: -fveclib=ArmPL -o - %s | FileCheck -check-prefix=ARMPL %s
+// RUN: %clang -S -target aarch64-unknown-linux-gnu -O2 -fno-math-errno \
+// RUN: -fveclib=SLEEF -o - %s | FileCheck -check-prefix=SLEEF %s
+
+typedef __SIZE_TYPE__ size_t;
+
+void sincos(double, double *, double *);
+
+// ARMPL: armpl_vsincosq_f64
+// ARMPL: armpl_vsincosq_f64
+
+// SLEEF: _ZGVnN2vl8l8_sincos
+// SLEEF: _ZGVnN2vl8l8_sincos
+void vectorize_sincos(double *restrict x, double *restrict s,
+ double *restrict c, size_t n) {
+ for (size_t i = 0; i < n; ++i) {
+ sincos(x[i], &s[i], &c[i]);
+ }
+}
diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
index 78954431e81c3..3b6cc0d1944fd 100644
--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
@@ -14,6 +14,7 @@
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/Pass.h"
#include "llvm/Support/Compiler.h"
#include "llvm/TargetParser/Triple.h"
@@ -23,7 +24,6 @@
namespace llvm {
template <typename T> class ArrayRef;
-enum class VectorLibrary;
/// Provides info so a possible vectorization of a function can be
/// computed. Function 'VectorFnName' is equivalent to 'ScalarFnName'
@@ -119,7 +119,8 @@ class TargetLibraryInfoImpl {
public:
TargetLibraryInfoImpl() = delete;
- LLVM_ABI explicit TargetLibraryInfoImpl(const Triple &T);
+ LLVM_ABI explicit TargetLibraryInfoImpl(
+ const Triple &T, VectorLibrary VecLib = VectorLibrary::NoLibrary);
// Provide value semantics.
LLVM_ABI TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI);
diff --git a/llvm/include/llvm/CodeGen/CommandFlags.h b/llvm/include/llvm/CodeGen/CommandFlags.h
index 59aacc75e055d..6a907b64542ae 100644
--- a/llvm/include/llvm/CodeGen/CommandFlags.h
+++ b/llvm/include/llvm/CodeGen/CommandFlags.h
@@ -125,6 +125,8 @@ LLVM_ABI llvm::EABI getEABIVersion();
LLVM_ABI llvm::DebuggerKind getDebuggerTuningOpt();
+LLVM_ABI llvm::VectorLibrary getVectorLibrary();
+
LLVM_ABI bool getEnableStackSizeSection();
LLVM_ABI bool getEnableAddrsig();
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 0afe32a4ecc3c..cf96547063cd0 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -23,6 +23,7 @@
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compiler.h"
@@ -83,7 +84,8 @@ struct RuntimeLibcallsInfo {
const Triple &TT,
ExceptionHandling ExceptionModel = ExceptionHandling::None,
FloatABI::ABIType FloatABI = FloatABI::Default,
- EABI EABIVersion = EABI::Default, StringRef ABIName = "");
+ EABI EABIVersion = EABI::Default, StringRef ABIName = "",
+ VectorLibrary VecLib = VectorLibrary::NoLibrary);
explicit RuntimeLibcallsInfo(const Module &M);
diff --git a/llvm/include/llvm/IR/SystemLibraries.h b/llvm/include/llvm/IR/SystemLibraries.h
index 1713b07c1c86f..5bdf67642e0e4 100644
--- a/llvm/include/llvm/IR/SystemLibraries.h
+++ b/llvm/include/llvm/IR/SystemLibraries.h
@@ -29,11 +29,6 @@ enum class VectorLibrary {
AMDLIBM // AMD Math Vector library.
};
-/// Command line flag value for the vector math library to use
-///
-/// FIXME: This should come from a module flag, and not be mutually exclusive
-extern VectorLibrary ClVectorLibrary;
-
} // namespace llvm
#endif // LLVM_IR_SYSTEMLIBRARIES_H
diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h
index bfd2817b8d1f5..b9258c0fee692 100644
--- a/llvm/include/llvm/Target/TargetOptions.h
+++ b/llvm/include/llvm/Target/TargetOptions.h
@@ -15,6 +15,7 @@
#define LLVM_TARGET_TARGETOPTIONS_H
#include "llvm/ADT/FloatingPointMode.h"
+#include "llvm/IR/SystemLibraries.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compiler.h"
@@ -409,6 +410,9 @@ class TargetOptions {
/// Which debugger to tune for.
DebuggerKind DebuggerTuning = DebuggerKind::Default;
+ /// Vector math library to use.
+ VectorLibrary VectorLibrary = VectorLibrary::NoLibrary;
+
private:
/// Flushing mode to assume in default FP environment.
DenormalMode FPDenormalMode;
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index f97abc9a32707..26d0c108fb03a 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -160,7 +160,8 @@ static void initializeBase(TargetLibraryInfoImpl &TLI, const Triple &T) {
/// target triple. This should be carefully written so that a missing target
/// triple gets a sane set of defaults.
static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
- ArrayRef<StringLiteral> StandardNames) {
+ ArrayRef<StringLiteral> StandardNames,
+ VectorLibrary VecLib) {
// Set IO unlocked variants as unavailable
// Set them as available per system below
TLI.setUnavailable(LibFunc_getc_unlocked);
@@ -924,23 +925,25 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
if (T.isOSAIX())
TLI.setUnavailable(LibFunc_memrchr);
- TLI.addVectorizableFunctionsFromVecLib(ClVectorLibrary, T);
+ TLI.addVectorizableFunctionsFromVecLib(VecLib, T);
}
/// Initialize the set of available library functions based on the specified
/// target triple. This should be carefully written so that a missing target
/// triple gets a sane set of defaults.
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
- ArrayRef<StringLiteral> StandardNames) {
+ ArrayRef<StringLiteral> StandardNames,
+ VectorLibrary VecLib) {
initializeBase(TLI, T);
- initializeLibCalls(TLI, T, StandardNames);
+ initializeLibCalls(TLI, T, StandardNames, VecLib);
}
-TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T) {
+TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T,
+ VectorLibrary VecLib) {
// Default to everything being available.
memset(AvailableArray, -1, sizeof(AvailableArray));
- initialize(*this, T, StandardNames);
+ initialize(*this, T, StandardNames, VecLib);
}
TargetLibraryInfoImpl::TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI)
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp
index cf225f1f03eac..02a6bb9357ad0 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -107,6 +107,7 @@ CGOPT(bool, UniqueBasicBlockSectionNames)
CGOPT(bool, SeparateNamedSections)
CGOPT(EABI, EABIVersion)
CGOPT(DebuggerKind, DebuggerTuningOpt)
+CGOPT(VectorLibrary, VectorLibrary)
CGOPT(bool, EnableStackSizeSection)
CGOPT(bool, EnableAddrsig)
CGOPT(bool, EnableCallGraphSection)
@@ -451,6 +452,28 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
clEnumValN(DebuggerKind::SCE, "sce", "SCE targets (e.g. PS4)")));
CGBINDOPT(DebuggerTuningOpt);
+ static cl::opt<VectorLibrary> VectorLibrary(
+ "vector-library", cl::Hidden, cl::desc("Vector functions library"),
+ cl::init(VectorLibrary::NoLibrary),
+ cl::values(
+ clEnumValN(VectorLibrary::NoLibrary, "none",
+ "No vector functions library"),
+ clEnumValN(VectorLibrary::Accelerate, "Accelerate",
+ "Accelerate framework"),
+ clEnumValN(VectorLibrary::DarwinLibSystemM, "Darwin_libsystem_m",
+ "Darwin libsystem_m"),
+ clEnumValN(VectorLibrary::LIBMVEC, "LIBMVEC",
+ "GLIBC Vector Math library"),
+ clEnumValN(VectorLibrary::MASSV, "MASSV", "IBM MASS vector library"),
+ clEnumValN(VectorLibrary::SVML, "SVML", "Intel SVML library"),
+ clEnumValN(VectorLibrary::SLEEFGNUABI, "sleefgnuabi",
+ "SIMD Library for Evaluating Elementary Functions"),
+ clEnumValN(VectorLibrary::ArmPL, "ArmPL",
+ "Arm Performance Libraries"),
+ clEnumValN(VectorLibrary::AMDLIBM, "AMDLIBM",
+ "AMD vector math library")));
+ CGBINDOPT(VectorLibrary);
+
static cl::opt<bool> EnableStackSizeSection(
"stack-size-section",
cl::desc("Emit a section containing stack size metadata"),
@@ -609,6 +632,7 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
Options.EnableTLSDESC =
getExplicitEnableTLSDESC().value_or(TheTriple.hasDefaultTLSDESC());
Options.ExceptionModel = getExceptionModel();
+ Options.VectorLibrary = getVectorLibrary();
Options.EmitStackSizeSection = getEnableStackSizeSection();
Options.EnableMachineFunctionSplitter = getEnableMachineFunctionSplitter();
Options.EnableStaticDataPartitioning = getEnableStaticDataPartitioning();
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 77d9b156e2672..0f1e37bbf1bfc 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -753,7 +753,8 @@ TargetLoweringBase::TargetLoweringBase(const TargetMachine &tm)
: TM(tm),
RuntimeLibcallInfo(TM.getTargetTriple(), TM.Options.ExceptionModel,
TM.Options.FloatABIType, TM.Options.EABIVersion,
- TM.Options.MCOptions.getABIName()),
+ TM.Options.MCOptions.getABIName(),
+ TM.Options.VectorLibrary),
Libcalls(RuntimeLibcallInfo) {
initActions();
diff --git a/llvm/lib/IR/CMakeLists.txt b/llvm/lib/IR/CMakeLists.txt
index ebdc2ca08d102..10572ff708bd3 100644
--- a/llvm/lib/IR/CMakeLists.txt
+++ b/llvm/lib/IR/CMakeLists.txt
@@ -67,7 +67,6 @@ add_llvm_component_library(LLVMCore
ReplaceConstant.cpp
Statepoint.cpp
StructuralHash.cpp
- SystemLibraries.cpp
Type.cpp
TypedPointerType.cpp
TypeFinder.cpp
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index ee23b58742b64..12d050329a302 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -29,7 +29,8 @@ using namespace RTLIB;
RuntimeLibcallsInfo::RuntimeLibcallsInfo(const Triple &TT,
ExceptionHandling ExceptionModel,
FloatABI::ABIType FloatABI,
- EABI EABIVersion, StringRef ABIName) {
+ EABI EABIVersion, StringRef ABIName,
+ VectorLibrary VecLib) {
// FIXME: The ExceptionModel parameter is to handle the field in
// TargetOptions. This interface fails to distinguish the forced disable
// case for targets which support exceptions by default. This should
@@ -40,7 +41,7 @@ RuntimeLibcallsInfo::RuntimeLibcallsInfo(const Triple &TT,
initLibcalls(TT, ExceptionModel, FloatABI, EABIVersion, ABIName);
// TODO: Tablegen should generate these sets
- switch (ClVectorLibrary) {
+ switch (VecLib) {
case VectorLibrary::SLEEFGNUABI:
for (RTLIB::LibcallImpl Impl :
{RTLIB::impl__ZGVnN2vl8_modf, RTLIB::impl__ZGVnN4vl4_modff,
diff --git a/llvm/lib/IR/SystemLibraries.cpp b/llvm/lib/IR/SystemLibraries.cpp
deleted file mode 100644
index fa4ac2adb7296..0000000000000
--- a/llvm/lib/IR/SystemLibraries.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//===-----------------------------------------------------------------------==//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/IR/SystemLibraries.h"
-#include "llvm/Support/CommandLine.h"
-
-using namespace llvm;
-
-VectorLibrary llvm::ClVectorLibrary;
-
-static cl::opt<VectorLibrary, true> ClVectorLibraryOpt(
- "vector-library", cl::Hidden, cl::desc("Vector functions library"),
- cl::location(llvm::ClVectorLibrary), cl::init(VectorLibrary::NoLibrary),
- cl::values(
- clEnumValN(VectorLibrary::NoLibrary, "none",
- "No vector functions library"),
- clEnumValN(VectorLibrary::Accelerate, "Accelerate",
- "Accelerate framework"),
- clEnumValN(VectorLibrary::DarwinLibSystemM, "Darwin_libsystem_m",
- "Darwin libsystem_m"),
- clEnumValN(VectorLibrary::LIBMVEC, "LIBMVEC",
- "GLIBC Vector Math library"),
- clEnumValN(VectorLibrary::MASSV, "MASSV", "IBM MASS vector library"),
- clEnumValN(VectorLibrary::SVML, "SVML", "Intel SVML library"),
- clEnumValN(VectorLibrary::SLEEFGNUABI, "sleefgnuabi",
- "SIMD Library for Evaluating Elementary Functions"),
- clEnumValN(VectorLibrary::ArmPL, "ArmPL", "Arm Performance Libraries"),
- clEnumValN(VectorLibrary::AMDLIBM, "AMDLIBM",
- "AMD vector math library")));
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 2147945d8a416..1cfedad15ec35 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -696,7 +696,8 @@ static int compileModule(char **argv, LLVMContext &Context,
}
// Add an appropriate TargetLibraryInfo pass for the module's triple.
- TargetLibraryInfoImpl TLII(M->getTargetTriple());
+ TargetLibraryInfoImpl TLII(M->getTargetTriple(),
+ Target->Options.VectorLibrary);
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (DisableSimplifyLibCalls)
diff --git a/llvm/tools/opt/optdriver.cpp b/llvm/tools/opt/optdriver.cpp
index 4cf117f227c00..d24c8abef31d0 100644
--- a/llvm/tools/opt/optdriver.cpp
+++ b/llvm/tools/opt/optdriver.cpp
@@ -670,13 +670,15 @@ optMain(int argc, char **argv,
M->addModuleFlag(Module::Error, "UnifiedLTO", 1);
}
+ VectorLibrary VecLib = codegen::getVectorLibrary();
// Add an appropriate TargetLibraryInfo pass for the module's triple.
- TargetLibraryInfoImpl TLII(ModuleTriple);
+ TargetLibraryInfoImpl TLII(ModuleTriple, VecLib);
- // FIXME: Get ABI name from MCOptions
RTLIB::RuntimeLibcallsInfo RTLCI(ModuleTriple, codegen::getExceptionModel(),
codegen::getFloatABIForCalls(),
- codegen::getEABIVersion());
+ codegen::getEABIVersion(),
+ "", // FIXME: Get ABI name from MCOptions
+ VecLib);
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (DisableSimplifyLibCalls)
diff --git a/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
index 8037c8d693cb8..22aa0b6418132 100644
--- a/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
@@ -82,7 +82,6 @@ static_library("IR") {
"SafepointIRVerifier.cpp",
"Statepoint.cpp",
"StructuralHash.cpp",
- "SystemLibraries.cpp",
"Type.cpp",
"TypeFinder.cpp",
"TypedPointerType.cpp",
|
ilovepi
left a comment
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.
LGTM.
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/42220 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/23/builds/15541 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/205/builds/27974 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/29183 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/204/builds/27995 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/166/builds/3925 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/63/builds/11868 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/130/builds/16191 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/125/builds/11521 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/193/builds/12141 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/113/builds/9539 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/107/builds/15486 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/152/builds/6246 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/28307 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/28447 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/7/builds/17628 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/202/builds/4189 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/161/builds/9019 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/90/builds/6628 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/186/builds/13976 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/108/builds/19859 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/119/builds/7327 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/39/builds/8706 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/151/builds/7417 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/110/builds/6311 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/127/builds/5318 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/20/builds/13890 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/13/builds/10602 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/38/builds/6343 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/6526 Here is the relevant piece of the build log for the reference |

This fixes the -fveclib flag getting lost on its way to the backend.
Previously this was its own cl::opt with a random boolean. Move the
flag handling into CommandFlags with other backend ABI-ish options,
and have clang directly set it, rather than forcing it to go through
command line parsing.
Prior to de68181, codegen used TargetLibraryInfo to find the vector
function. Clang has special handling for TargetLibraryInfo, where it would
directly construct one with the vector library in the pass pipeline.
RuntimeLibcallsInfo currently is not used as an analysis in codegen, and
needs to know the vector library when constructed.
RuntimeLibraryAnalysis could follow the same trick that TargetLibraryInfo is
using in the future, but a lot more boilerplate changes are needed to thread
that analysis through codegen. Ideally this would come from an IR module flag,
and nothing would be in TargetOptions. For now, it's better for all of these
sorts of controls to be consistent.