CodeGen: Remove TargetOptions::FloatABIType - #215796
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
@llvm/pr-subscribers-llvm-analysis @llvm/pr-subscribers-llvm-selectiondag Author: Matt Arsenault (arsenm) ChangesThis is now fully replaced with the "float-abi" module flag. RuntimeLibraryAnalysis now defers analysis until run() on a Module, Unfortunately, ARM still depends on TargetOptions for determining Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com> Patch is 30.83 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/215796.diff 29 Files Affected:
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index e95552b7e9e06..16fb29d75be70 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -392,17 +392,6 @@ static bool initTargetOptions(const CompilerInstance &CI,
break;
}
- // Set float ABI type.
- assert((CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp" ||
- CodeGenOpts.FloatABI == "hard" || CodeGenOpts.FloatABI.empty()) &&
- "Invalid Floating Point ABI!");
- Options.FloatABIType =
- llvm::StringSwitch<llvm::FloatABI::ABIType>(CodeGenOpts.FloatABI)
- .Case("soft", llvm::FloatABI::Soft)
- .Case("softfp", llvm::FloatABI::Soft)
- .Case("hard", llvm::FloatABI::Hard)
- .Default(llvm::FloatABI::Default);
-
// Set FP fusion mode.
switch (LangOpts.getDefaultFPContractMode()) {
case LangOptions::FPM_Off:
@@ -1275,9 +1264,9 @@ void EmitAssemblyHelper::RunCodegenPipelineLegacy(
CodeGenPasses.add(new TargetLibraryInfoWrapperPass(*TLII));
const llvm::TargetOptions &Options = TM->Options;
- CodeGenPasses.add(new RuntimeLibraryInfoWrapper(
- TargetTriple, Options.ExceptionModel, Options.FloatABIType,
- Options.EABIVersion, Options.MCOptions.ABIName, Options.VecLib));
+ CodeGenPasses.add(
+ new RuntimeLibraryInfoWrapper(Options.ExceptionModel, Options.EABIVersion,
+ Options.MCOptions.ABIName, Options.VecLib));
if (TM->addPassesToEmitFile(CodeGenPasses, *OS,
DwoOS ? &DwoOS->os() : nullptr, CGFT,
diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index e21590cc9fa7f..7ecda651027e2 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -920,8 +920,8 @@ static void generateMachineCodeOrAssemblyImpl(
llvm::driver::createTLII(triple, codeGenOpts.getVecLib());
codeGenPasses.add(new llvm::TargetLibraryInfoWrapperPass(*tlii));
codeGenPasses.add(new llvm::RuntimeLibraryInfoWrapper(
- triple, tm.Options.ExceptionModel, tm.Options.FloatABIType,
- tm.Options.EABIVersion, tm.Options.MCOptions.ABIName, tm.Options.VecLib));
+ tm.Options.ExceptionModel, tm.Options.EABIVersion,
+ tm.Options.MCOptions.ABIName, tm.Options.VecLib));
std::unique_ptr<llvm::ToolOutputFile> dwoOS;
if (!codeGenOpts.SplitDwarfOutput.empty()) {
@@ -1040,8 +1040,8 @@ void CodeGenAction::runOptimizationPipeline(llvm::raw_pwrite_stream &os) {
fam.registerPass([&] { return llvm::TargetLibraryAnalysis(*tlii); });
mam.registerPass([&] {
return llvm::RuntimeLibraryAnalysis(
- triple, targetMachine->Options.ExceptionModel,
- targetMachine->Options.FloatABIType, targetMachine->Options.EABIVersion,
+ targetMachine->Options.ExceptionModel,
+ targetMachine->Options.EABIVersion,
targetMachine->Options.MCOptions.ABIName,
targetMachine->Options.VecLib);
});
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index 40e0303f77e86..ee128b416463d 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -54,6 +54,9 @@ Makes programs 10x faster by doing Special New Thing.
### Changes to LLVM infrastructure
+* Removed `TargetOptions::FloatABIType`. The soft float ABI should be
+ controlled by setting the `"float-abi"` module flag.
+
### Changes to building LLVM
### Changes to TableGen
diff --git a/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h b/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h
index 3054177bc6cce..f4d81b2f1e057 100644
--- a/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h
+++ b/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h
@@ -11,6 +11,8 @@
#include "llvm/IR/RuntimeLibcalls.h"
#include "llvm/Pass.h"
+#include <optional>
+#include <string>
namespace llvm {
@@ -20,24 +22,26 @@ class LLVM_ABI RuntimeLibraryAnalysis
using Result = RTLIB::RuntimeLibcallsInfo;
RuntimeLibraryAnalysis() = default;
- RuntimeLibraryAnalysis(RTLIB::RuntimeLibcallsInfo &&BaselineInfoImpl)
- : LibcallsInfo(std::move(BaselineInfoImpl)) {}
- RuntimeLibraryAnalysis(
- const Triple &TT,
- ExceptionHandling ExceptionModel = ExceptionHandling::None,
- FloatABI::ABIType FloatABI = FloatABI::Default,
- EABI EABIVersion = EABI::Default, StringRef ABIName = "",
- VectorLibrary VecLib = VectorLibrary::NoLibrary);
+ RuntimeLibraryAnalysis(ExceptionHandling ExceptionModel,
+ EABI EABIVersion = EABI::Default,
+ StringRef ABIName = "",
+ VectorLibrary VecLib = VectorLibrary::NoLibrary)
+ : ExceptionModel(ExceptionModel), EABIVersion(EABIVersion),
+ ABIName(ABIName.str()), VecLib(VecLib) {}
RTLIB::RuntimeLibcallsInfo run(const Module &M, ModuleAnalysisManager &);
- operator bool() const { return LibcallsInfo.has_value(); }
-
private:
friend AnalysisInfoMixin<RuntimeLibraryAnalysis>;
static AnalysisKey Key;
- std::optional<RTLIB::RuntimeLibcallsInfo> LibcallsInfo;
+ // FIXME: These are TargetOptions values that are not yet represented in the
+ // IR, copied here so run() can forward them to the RuntimeLibcallsInfo Module
+ // constructor. Delete each one as they are migrated to module flags.
+ ExceptionHandling ExceptionModel = ExceptionHandling::None;
+ EABI EABIVersion = EABI::Default;
+ std::string ABIName;
+ VectorLibrary VecLib = VectorLibrary::NoLibrary;
};
class LLVM_ABI RuntimeLibraryInfoWrapper : public ImmutablePass {
@@ -47,12 +51,10 @@ class LLVM_ABI RuntimeLibraryInfoWrapper : public ImmutablePass {
public:
static char ID;
RuntimeLibraryInfoWrapper();
- RuntimeLibraryInfoWrapper(
- const Triple &TT,
- ExceptionHandling ExceptionModel = ExceptionHandling::None,
- FloatABI::ABIType FloatABI = FloatABI::Default,
- EABI EABIVersion = EABI::Default, StringRef ABIName = "",
- VectorLibrary VecLib = VectorLibrary::NoLibrary);
+ RuntimeLibraryInfoWrapper(ExceptionHandling ExceptionModel,
+ EABI EABIVersion = EABI::Default,
+ StringRef ABIName = "",
+ VectorLibrary VecLib = VectorLibrary::NoLibrary);
const RTLIB::RuntimeLibcallsInfo &getRTLCI(const Module &M) {
if (!RTLCI) {
diff --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h
index 53927e96a232e..6090644f7a12f 100644
--- a/llvm/include/llvm/IR/Module.h
+++ b/llvm/include/llvm/IR/Module.h
@@ -1066,7 +1066,7 @@ class LLVM_ABI Module {
/// @{
/// Returns the floating-point ABI recorded by the "float-abi" module flag, or
- /// FloatABI::Default when the flag is absent (meaning the target default).
+ /// the ABI implied by the target triple when the flag is absent.
FloatABI::ABIType getFloatABI() const;
/// @}
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 78b75f3e81c3b..8519100f9f80a 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -87,7 +87,16 @@ struct RuntimeLibcallsInfo {
EABI EABIVersion = EABI::Default, StringRef ABIName = "",
VectorLibrary VecLib = VectorLibrary::NoLibrary);
- LLVM_ABI explicit RuntimeLibcallsInfo(const Module &M);
+ // FIXME: The floating-point ABI is read from the "float-abi" module flag, but
+ // the ExceptionModel/EABIVersion/ABIName/VecLib parameters are still
+ // TargetOptions values that are not yet represented in the IR. Delete these
+ // parameters (and build everything from the Module) once those fields are
+ // migrated to module flags.
+ LLVM_ABI explicit RuntimeLibcallsInfo(
+ const Module &M,
+ ExceptionHandling ExceptionModel = ExceptionHandling::None,
+ EABI EABIVersion = EABI::Default, StringRef ABIName = "",
+ VectorLibrary VecLib = VectorLibrary::NoLibrary);
LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
ModuleAnalysisManager::Invalidator &);
diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h
index dc8b2ebceee46..f6c862e99b98f 100644
--- a/llvm/include/llvm/Target/TargetOptions.h
+++ b/llvm/include/llvm/Target/TargetOptions.h
@@ -358,14 +358,6 @@ class TargetOptions {
/// If greater than 0, override TargetLoweringBase::PrefLoopAlignment.
unsigned LoopAlignment = 0;
- /// FloatABIType - This setting is set by -float-abi=xxx option is specfied
- /// on the command line. This setting may either be Default, Soft, or Hard.
- /// Default selects the target's default behavior. Soft selects the ABI for
- /// software floating point, but does not indicate that FP hardware may not
- /// be used. Such a combination is unfortunately popular (e.g.
- /// arm-apple-darwin). Hard presumes that the normal FP ABI is used.
- FloatABI::ABIType FloatABIType = FloatABI::Default;
-
/// AllowFPOpFusion - This flag is set by the -fp-contract=xxx option.
/// This controls the creation of fused FP ops that store intermediate
/// results in higher precision than IEEE allows (E.g. FMAs).
diff --git a/llvm/lib/Analysis/RuntimeLibcallInfo.cpp b/llvm/lib/Analysis/RuntimeLibcallInfo.cpp
index 1c5a1cc75b7bd..23dca93c4d884 100644
--- a/llvm/lib/Analysis/RuntimeLibcallInfo.cpp
+++ b/llvm/lib/Analysis/RuntimeLibcallInfo.cpp
@@ -13,34 +13,21 @@ using namespace llvm;
AnalysisKey RuntimeLibraryAnalysis::Key;
-RuntimeLibraryAnalysis::RuntimeLibraryAnalysis(const Triple &TT,
- ExceptionHandling ExceptionModel,
- FloatABI::ABIType FloatABI,
- EABI EABIVersion,
- StringRef ABIName,
- VectorLibrary VecLib)
- : LibcallsInfo(std::in_place, TT, ExceptionModel, FloatABI, EABIVersion,
- ABIName, VecLib) {}
-
RTLIB::RuntimeLibcallsInfo
RuntimeLibraryAnalysis::run(const Module &M, ModuleAnalysisManager &) {
- if (!LibcallsInfo)
- LibcallsInfo = RTLIB::RuntimeLibcallsInfo(M);
- return *LibcallsInfo;
+ return RTLIB::RuntimeLibcallsInfo(M, ExceptionModel, EABIVersion, ABIName,
+ VecLib);
}
INITIALIZE_PASS(RuntimeLibraryInfoWrapper, "runtime-library-info",
"Runtime Library Function Analysis", false, true)
-RuntimeLibraryInfoWrapper::RuntimeLibraryInfoWrapper()
- : ImmutablePass(ID), RTLA(RTLIB::RuntimeLibcallsInfo(Triple())) {}
+RuntimeLibraryInfoWrapper::RuntimeLibraryInfoWrapper() : ImmutablePass(ID) {}
RuntimeLibraryInfoWrapper::RuntimeLibraryInfoWrapper(
- const Triple &TT, ExceptionHandling ExceptionModel,
- FloatABI::ABIType FloatABI, EABI EABIVersion, StringRef ABIName,
+ ExceptionHandling ExceptionModel, EABI EABIVersion, StringRef ABIName,
VectorLibrary VecLib)
- : ImmutablePass(ID), RTLCI(std::in_place, TT, ExceptionModel, FloatABI,
- EABIVersion, ABIName, VecLib) {}
+ : ImmutablePass(ID), RTLA(ExceptionModel, EABIVersion, ABIName, VecLib) {}
char RuntimeLibraryInfoWrapper::ID = 0;
diff --git a/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp b/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp
index b66e1027e64c2..d869c123c2046 100644
--- a/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp
+++ b/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp
@@ -129,9 +129,9 @@ addPassesToGenerateCode(CodeGenTargetMachineImpl &TM, PassManagerBase &PM,
const TargetOptions &Options = TM.Options;
TargetLibraryInfoImpl TLII(TM.getTargetTriple(), Options.VecLib);
PM.add(new TargetLibraryInfoWrapperPass(TLII));
- PM.add(new RuntimeLibraryInfoWrapper(
- TM.getTargetTriple(), Options.ExceptionModel, Options.FloatABIType,
- Options.EABIVersion, Options.MCOptions.ABIName, Options.VecLib));
+ PM.add(
+ new RuntimeLibraryInfoWrapper(Options.ExceptionModel, Options.EABIVersion,
+ Options.MCOptions.ABIName, Options.VecLib));
invokeGlobalTargetPassConfigCallbacks(TM, PM, PassConfig);
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp
index 88987d0bc5558..24d46c6dcfe94 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -590,8 +590,6 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
Options.HonorSignDependentRoundingFPMathOption =
getEnableHonorSignDependentRoundingFPMath();
- if (getFloatABIForCalls() != FloatABI::Default)
- Options.FloatABIType = getFloatABIForCalls();
Options.EnableAIXExtendedAltivecABI = getEnableAIXExtendedAltivecABI();
Options.NoZerosInBSS = getDontPlaceZerosInBSS();
Options.GuaranteedTailCallOpt = getEnableGuaranteedTailCallOpt();
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 71eda1048bc11..3213788b71dc8 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -944,7 +944,8 @@ TargetLoweringBase::TargetLoweringBase(const TargetMachine &tm,
const TargetSubtargetInfo &STI)
: TM(tm),
RuntimeLibcallInfo(TM.getTargetTriple(), TM.Options.ExceptionModel,
- TM.Options.FloatABIType, TM.Options.EABIVersion,
+ TM.getTargetTriple().getDefaultFloatABI(),
+ TM.Options.EABIVersion,
TM.Options.MCOptions.getABIName(), TM.Options.VecLib),
Libcalls(RuntimeLibcallInfo, STI) {
initActions();
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index 2ae76b80ccd57..510d33c0ad295 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -700,8 +700,10 @@ void Module::setLongDoubleFormat(LongDoubleFormat Format) {
FloatABI::ABIType Module::getFloatABI() const {
if (auto *Val = dyn_cast_or_null<MDString>(getModuleFlag("float-abi")))
- return FloatABI::parseABIType(Val->getString()).value_or(FloatABI::Default);
- return FloatABI::Default;
+ return *FloatABI::parseABIType(Val->getString());
+ // Without an explicit flag, fall back to the ABI implied by the target
+ // triple.
+ return getTargetTriple().getDefaultFloatABI();
}
std::optional<uint64_t> Module::getLargeDataThreshold() const {
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index ad7d3320f8928..d8069e207d3ef 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -101,10 +101,12 @@ RuntimeLibcallsInfo::RuntimeLibcallsInfo(const Triple &TT,
}
}
-RuntimeLibcallsInfo::RuntimeLibcallsInfo(const Module &M)
- : RuntimeLibcallsInfo(M.getTargetTriple()) {
- // TODO: Consider module flags
-}
+RuntimeLibcallsInfo::RuntimeLibcallsInfo(const Module &M,
+ ExceptionHandling ExceptionModel,
+ EABI EABIVersion, StringRef ABIName,
+ VectorLibrary VecLib)
+ : RuntimeLibcallsInfo(M.getTargetTriple(), ExceptionModel, M.getFloatABI(),
+ EABIVersion, ABIName, VecLib) {}
/// Set default libcall names. If a target wants to opt-out of a libcall it
/// should be placed here.
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 73697a9d0d446..69bc3fdae6c57 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -485,8 +485,7 @@ static void codegen(const Config &Conf, TargetMachine *TM,
TargetLibraryInfoImpl TLII(Mod.getTargetTriple(), TM->Options.VecLib);
CodeGenPasses.add(new TargetLibraryInfoWrapperPass(TLII));
CodeGenPasses.add(new RuntimeLibraryInfoWrapper(
- Mod.getTargetTriple(), TM->Options.ExceptionModel,
- TM->Options.FloatABIType, TM->Options.EABIVersion,
+ TM->Options.ExceptionModel, TM->Options.EABIVersion,
TM->Options.MCOptions.ABIName, TM->Options.VecLib));
// No need to make index available if the module is empty.
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
index 59ad547dc26d7..11f7929cb6dbe 100644
--- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -698,11 +698,7 @@ void ARMAsmPrinter::emitAttributes() {
}
const ARMBaseTargetMachine &ATM =
static_cast<const ARMBaseTargetMachine &>(TM);
- // The float ABI comes from the "float-abi" module flag if present, otherwise
- // from the legacy -float-abi target option.
- FloatABI::ABIType FloatABI = MMI->getModule()->getFloatABI();
- if (FloatABI == FloatABI::Default)
- FloatABI = ATM.Options.FloatABIType;
+ FloatABI::ABIType FloatABI = ATM.getFloatABI(*MMI->getModule());
const ARMSubtarget STI(TT, std::string(CPU), ArchFS, ATM,
ATM.isLittleEndian(), FloatABI);
diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.cpp b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
index 3d388a7db6687..a1ced45a83e63 100644
--- a/llvm/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
@@ -156,16 +156,6 @@ ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, const Triple &TT,
TargetABI(ARM::computeTargetABI(TT, Options.MCOptions.ABIName)),
TLOF(createTLOF(getTargetTriple())), isLittle(TT.isLittleEndian()) {
- // Default to triple-appropriate float ABI. -target-abi=aapcs16 forces hard
- // float regardless of the triple default.
- if (Options.FloatABIType == FloatABI::Default) {
- if (TargetABI == ARM::ARM_ABI_AAPCS16 ||
- TT.getDefaultFloatABI() == FloatABI::Hard)
- this->Options.FloatABIType = FloatABI::Hard;
- else
- this->Options.FloatABIType = FloatABI::Soft;
- }
-
// Default to triple-appropriate EABI
if (Options.EABIVersion == EABI::Default ||
Options.EABIVersion == EABI::Unknown) {
@@ -207,6 +197,20 @@ MachineFunctionInfo *ARMBaseTargetMachine::createMachineFunctionInfo(
Allocator, F, static_cast<const ARMSubtarget *>(STI));
}
+FloatABI::ABIType ARMBaseTargetMachine::getFloatABI(const Module &M) const {
+ // An explicit "float-abi" module flag always wins, even for AAPCS16.
+ if (auto *Val = dyn_cast_or_null<MDString>(M.getModuleFlag("float-abi")))
+ return *FloatABI::parseABIType(Val->getString());
+
+ // With no explicit ABI, an explicit -target-abi=aapcs16 forces hard float
+ // even on triples whose default float ABI is soft (the triple default only
+ // detects AAPCS16 when it is the triple's own default ABI).
+ if (TargetABI == ARM::ARM_ABI_AAPCS16)
+ return FloatABI::Hard;
+ // Otherwise fall back to the ABI implied by the target triple.
+ return M.getTargetTriple().getDefaultFloatABI();
+}
+
const ARMSubtarget *
ARMBaseTargetMachine::getSubtargetImpl(const Function &F) const {
Attribute CPUAttr = F.getFnAttribute("target-cpu");
@@ -238,16 +242,7 @@ ARMBaseTargetMachine::getSubtargetImpl(const Function &F) const {
if (DM != DenormalMode::getIEEE())
Key += "denormal-fp-math=" + DM.str();
- // The float ABI comes from the "float-abi" module flag if present, otherwise
- // from the legacy -float-abi target option (which the constructor seeded from
- // the target triple).
- FloatABI::ABIType FloatABI = F.getParent()->getFloatABI();
- if (FloatABI == FloatABI::Default) {
- FloatABI = Options.FloatABIType;
- assert(FloatABI != FloatABI::Default &&
- "expected TargetMachine constructor to overwrite default float abi");
- }
-
+ FloatABI::ABIType FloatABI = getFloatABI(*F.getParent());
// It is legal to have FloatABI::Hard with +soft-float for targets with SIMD
// registers, but no floating-point hardware (mve+nofp)
Key += FloatABI == FloatABI::Hard ? "+hard-float-abi" : "+soft-float-abi";
diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.h b/llvm/lib/Target/ARM/ARMTargetMachine.h
index 1d373e65978f9..81dc7a5965f6f 100644
--- a/llvm/lib/Target/ARM/ARMTargetMachine.h
+++ b/llvm/lib/Target/ARM/ARMTargetMachine.h
@@ -52,6 +52,11 @@ class ARMBaseTargetMachine : public CodeGenTargetMachineImpl {
const ARMSubtarget *getSubtargetImpl() const = delete;
bool isLittleEndian() const { return isLittle; }
+ /// Returns the floating-point ABI ...
[truncated]
|
771defe to
6355d80
Compare
05a4564 to
2fac20d
Compare
🐧 Linux x64 Test Results
✅ The build succeeded and all tests passed. |
2fac20d to
00fb3f7
Compare
6355d80 to
33237f7
Compare
This is now fully replaced with the "float-abi" module flag. If the module flag is not present, the default is computed from the triple. Consumers are updated to read the module flag. RuntimeLibraryAnalysis now defers analysis until run() on a Module, instead of during the pass constructor as before. This requires copying all of the remaining relevant TargetOptions so they are available when the module is seen. Unfortunately, ARM still depends on TargetOptions for determining the float-abi. -target-abi=aapcs16 still changes the default float-abi, but an explicit module flag wins. Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
6d7e249 to
c24ac2f
Compare
e6be2fd to
274d957
Compare
ilovepi
left a comment
There was a problem hiding this comment.
This seems like a nice cleanup.
This is now fully replaced with the "float-abi" module flag. If the module flag is not present, the default is computed from the triple. Consumers are updated to read the module flag. RuntimeLibraryAnalysis now defers analysis until run() on a Module, instead of during the pass constructor as before. This requires copying all of the remaining relevant TargetOptions so they are available when the module is seen. Unfortunately, ARM still depends on TargetOptions for determining the float-abi. -target-abi=aapcs16 still changes the default float-abi, but an explicit module flag wins. Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
|
This patch broke the Solaris/sparcv9 buildbot. |
|
I noticed that with this patch llvm complains about llvm-stress generated output, e.g. fails with Is that as expected? |
Kind of, it's a side effect. There are 2 things going on here. The short answer is stop using -march, and only use -mtriple. We should probably remove -march, it inherits the other triple fields from the host which is bad for reproducibility. The host must be missing the matching call, so it now fails. That it fails is a different bug, which is ExpandIRInsts doesn't appear to be consulting the libcall action |
Ok good, then I'll just switch from -march to -mtriple in those tests. |
This is the same problem as #203725 so this should just xfail sparc |
|
|
This commit results in massive failures with existing LIT tests for our downstream toolchains, especially for Arm, similar to what others have reported above. We do use our own driver code, but I'm not sure where to begin to pinpoint what needs to be changed. Can you point me where to get started? |
Many of the failures are for Generic, which I think you also noted as being problematic, e.g.: |
Yes, generic is broken and I think all of these would be resolved by #203725 So the solutions are:
|
|
Hi @arsenm, These two LLVM tests get crashed with the memory access violation exception after these changes on Armv7 cross builder:
https://lab.llvm.org/buildbot/#/builders/38/builds/10659 The crash dump with debug info: Would you take care of it? |
It's the same as all the others, I hit merge on #203725 There's just an ARM specific bonus bug that it doesn't validate the library call exists before calling it, which indirectly results in the null use |
This is now fully replaced with the "float-abi" module flag. If the module flag is not present, the default is computed from the triple. Consumers are updated to read the module flag. RuntimeLibraryAnalysis now defers analysis until run() on a Module, instead of during the pass constructor as before. This requires copying all of the remaining relevant TargetOptions so they are available when the module is seen. Unfortunately, ARM still depends on TargetOptions for determining the float-abi. -target-abi=aapcs16 still changes the default float-abi, but an explicit module flag wins. Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
LLVM 24: configure float-abi via module flag `TargetOptions::FloatABIType` was removed in llvm/llvm-project#215796 See llvm/llvm-project#212985 for the corresponding clang change. The `ModuleFlagMergeBehavior::Error` was copied from the clang implementation. This currently relies on the string representation of Rust's [`FloatAbi` "target_spec_enum"](https://github.com/rust-lang/rust/blob/e71c0f1e3395b10a8c331317be1a5c107bdf7b2e/compiler/rustc_target/src/spec/mod.rs#L978-L986) matching LLVM. This seemed reasonable to me since the representation is quite straightforward ("soft" and "hard"), but let me know if you'd like an explicit `to_llvm_float_abi_str`, either defined in Rust or forwarding to `llvm::FloatABI::getABITypeName`. Contrary to the clang implementation which only sets the module flag if it differs from the target default, we set it whenever the Rust target has an explicit float ABI set. See also discussion in [#t-compiler/llvm > float-abi module flag behavior](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fllvm/topic/float-abi.20module.20flag.20behavior/with/617279073). The added test won't actually run on Rust's own CI until that updates to LLVM 24. @rustbot label llvm-main
LLVM 24: configure float-abi via module flag `TargetOptions::FloatABIType` was removed in llvm/llvm-project#215796 See llvm/llvm-project#212985 for the corresponding clang change. The `ModuleFlagMergeBehavior::Error` was copied from the clang implementation. This currently relies on the string representation of Rust's [`FloatAbi` "target_spec_enum"](https://github.com/rust-lang/rust/blob/e71c0f1e3395b10a8c331317be1a5c107bdf7b2e/compiler/rustc_target/src/spec/mod.rs#L978-L986) matching LLVM. This seemed reasonable to me since the representation is quite straightforward ("soft" and "hard"), but let me know if you'd like an explicit `to_llvm_float_abi_str`, either defined in Rust or forwarding to `llvm::FloatABI::getABITypeName`. Contrary to the clang implementation which only sets the module flag if it differs from the target default, we set it whenever the Rust target has an explicit float ABI set. See also discussion in [#t-compiler/llvm > float-abi module flag behavior](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fllvm/topic/float-abi.20module.20flag.20behavior/with/617279073). The added test won't actually run on Rust's own CI until that updates to LLVM 24. @rustbot label llvm-main
LLVM 24: configure float-abi via module flag `TargetOptions::FloatABIType` was removed in llvm/llvm-project#215796 See llvm/llvm-project#212985 for the corresponding clang change. The `ModuleFlagMergeBehavior::Error` was copied from the clang implementation. This currently relies on the string representation of Rust's [`FloatAbi` "target_spec_enum"](https://github.com/rust-lang/rust/blob/e71c0f1e3395b10a8c331317be1a5c107bdf7b2e/compiler/rustc_target/src/spec/mod.rs#L978-L986) matching LLVM. This seemed reasonable to me since the representation is quite straightforward ("soft" and "hard"), but let me know if you'd like an explicit `to_llvm_float_abi_str`, either defined in Rust or forwarding to `llvm::FloatABI::getABITypeName`. Contrary to the clang implementation which only sets the module flag if it differs from the target default, we set it whenever the Rust target has an explicit float ABI set. See also discussion in [#t-compiler/llvm > float-abi module flag behavior](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fllvm/topic/float-abi.20module.20flag.20behavior/with/617279073). The added test won't actually run on Rust's own CI until that updates to LLVM 24. @rustbot label llvm-main
LLVM 24: configure float-abi via module flag `TargetOptions::FloatABIType` was removed in llvm/llvm-project#215796 See llvm/llvm-project#212985 for the corresponding clang change. The `ModuleFlagMergeBehavior::Error` was copied from the clang implementation. This currently relies on the string representation of Rust's [`FloatAbi` "target_spec_enum"](https://github.com/rust-lang/rust/blob/e71c0f1e3395b10a8c331317be1a5c107bdf7b2e/compiler/rustc_target/src/spec/mod.rs#L978-L986) matching LLVM. This seemed reasonable to me since the representation is quite straightforward ("soft" and "hard"), but let me know if you'd like an explicit `to_llvm_float_abi_str`, either defined in Rust or forwarding to `llvm::FloatABI::getABITypeName`. Contrary to the clang implementation which only sets the module flag if it differs from the target default, we set it whenever the Rust target has an explicit float ABI set. See also discussion in [#t-compiler/llvm > float-abi module flag behavior](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fllvm/topic/float-abi.20module.20flag.20behavior/with/617279073). The added test won't actually run on Rust's own CI until that updates to LLVM 24. @rustbot label llvm-main
Rollup merge of #161317 - TimNN:float-abi-flag, r=khyperia LLVM 24: configure float-abi via module flag `TargetOptions::FloatABIType` was removed in llvm/llvm-project#215796 See llvm/llvm-project#212985 for the corresponding clang change. The `ModuleFlagMergeBehavior::Error` was copied from the clang implementation. This currently relies on the string representation of Rust's [`FloatAbi` "target_spec_enum"](https://github.com/rust-lang/rust/blob/e71c0f1e3395b10a8c331317be1a5c107bdf7b2e/compiler/rustc_target/src/spec/mod.rs#L978-L986) matching LLVM. This seemed reasonable to me since the representation is quite straightforward ("soft" and "hard"), but let me know if you'd like an explicit `to_llvm_float_abi_str`, either defined in Rust or forwarding to `llvm::FloatABI::getABITypeName`. Contrary to the clang implementation which only sets the module flag if it differs from the target default, we set it whenever the Rust target has an explicit float ABI set. See also discussion in [#t-compiler/llvm > float-abi module flag behavior](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fllvm/topic/float-abi.20module.20flag.20behavior/with/617279073). The added test won't actually run on Rust's own CI until that updates to LLVM 24. @rustbot label llvm-main
LLVM 24: configure float-abi via module flag `TargetOptions::FloatABIType` was removed in llvm/llvm-project#215796 See llvm/llvm-project#212985 for the corresponding clang change. The `ModuleFlagMergeBehavior::Error` was copied from the clang implementation. This currently relies on the string representation of Rust's [`FloatAbi` "target_spec_enum"](https://github.com/rust-lang/rust/blob/e71c0f1e3395b10a8c331317be1a5c107bdf7b2e/compiler/rustc_target/src/spec/mod.rs#L978-L986) matching LLVM. This seemed reasonable to me since the representation is quite straightforward ("soft" and "hard"), but let me know if you'd like an explicit `to_llvm_float_abi_str`, either defined in Rust or forwarding to `llvm::FloatABI::getABITypeName`. Contrary to the clang implementation which only sets the module flag if it differs from the target default, we set it whenever the Rust target has an explicit float ABI set. See also discussion in [#t-compiler/llvm > float-abi module flag behavior](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fllvm/topic/float-abi.20module.20flag.20behavior/with/617279073). The added test won't actually run on Rust's own CI until that updates to LLVM 24. @rustbot label llvm-main

This is now fully replaced with the "float-abi" module flag.
If the module flag is not present, the default is computed
from the triple. Consumers are updated to read the module flag.
RuntimeLibraryAnalysis now defers analysis until run() on a Module,
instead of during the pass constructor as before. This requires copying
all of the remaining relevant TargetOptions so they are available
when the module is seen.
Unfortunately, ARM still depends on TargetOptions for determining
the float-abi. -target-abi=aapcs16 still changes the default float-abi,
but an explicit module flag wins.
Co-authored-by: Claude (Claude-Opus-4.8) noreply@anthropic.com