-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[win][arm64ec] More fixes for building and testing Arm64EC Windows #151409
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
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-llvm-ir @llvm/pr-subscribers-backend-aarch64 Author: Daniel Paoliello (dpaoliello) Changes
Full diff: https://github.com/llvm/llvm-project/pull/151409.diff 5 Files Affected:
diff --git a/llvm/.gitattributes b/llvm/.gitattributes
index fc3afb28a8d52..9f4ed8a24ecd0 100644
--- a/llvm/.gitattributes
+++ b/llvm/.gitattributes
@@ -32,3 +32,4 @@ test/tools/split-file/basic.test text eol=lf
test/tools/split-file/Inputs/basic-*.txt eol=lf
test/tools/split-file/basic.crlf.test text eol=crlf
test/tools/split-file/Inputs/basic-*.crlf eol=crlf
+test/tools/llvm-objcopy/MachO/Inputs/macho_sections.s text eol=lf
diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp
index 010bd15e256dc..894cd2dab599a 100644
--- a/llvm/lib/IR/Mangler.cpp
+++ b/llvm/lib/IR/Mangler.cpp
@@ -292,6 +292,9 @@ void llvm::emitLinkerFlagsForUsedCOFF(raw_ostream &OS, const GlobalValue *GV,
}
std::optional<std::string> llvm::getArm64ECMangledFunctionName(StringRef Name) {
+ if (Name.empty())
+ reportFatalUsageError("ARM64EC does not support empty function names");
+
if (Name[0] != '?') {
// For non-C++ symbols, prefix the name with "#" unless it's already
// mangled.
diff --git a/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp b/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp
index 509cbb092705d..5b5c8aa1d6503 100644
--- a/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp
@@ -727,9 +727,6 @@ AArch64Arm64ECCallLowering::buildPatchableThunk(GlobalAlias *UnmangledAlias,
// Lower an indirect call with inline code.
void AArch64Arm64ECCallLowering::lowerCall(CallBase *CB) {
- assert(CB->getModule()->getTargetTriple().isOSWindows() &&
- "Only applicable for Windows targets");
-
IRBuilder<> B(CB);
Value *CalledOperand = CB->getCalledOperand();
@@ -872,7 +869,7 @@ bool AArch64Arm64ECCallLowering::runOnModule(Module &Mod) {
if (!F.isDeclaration() && (!F.hasLocalLinkage() || F.hasAddressTaken()) &&
F.getCallingConv() != CallingConv::ARM64EC_Thunk_Native &&
F.getCallingConv() != CallingConv::ARM64EC_Thunk_X64) {
- if (!F.hasComdat())
+ if (!F.hasComdat() && !F.isDeclarationForLinker())
F.setComdat(Mod.getOrInsertComdat(F.getName()));
ThunkMapping.push_back(
{&F, buildEntryThunk(&F), Arm64ECThunkType::Entry});
diff --git a/llvm/test/CodeGen/Generic/allow-check.ll b/llvm/test/CodeGen/Generic/allow-check.ll
index 148ee811ea806..97719a7af6229 100644
--- a/llvm/test/CodeGen/Generic/allow-check.ll
+++ b/llvm/test/CodeGen/Generic/allow-check.ll
@@ -6,6 +6,7 @@
; XFAIL: target=nvptx{{.*}}
; XFAIL: target=sparc{{.*}}
; XFAIL: target=hexagon-{{.*}}
+; XFAIL: target=arm64ec-{{.*}}
; RUN: llc < %s -O3 -global-isel=0 -fast-isel=0
; RUN: llc < %s -O3 -global-isel=1 -fast-isel=0
diff --git a/llvm/test/CodeGen/Generic/vector-constantexpr.ll b/llvm/test/CodeGen/Generic/vector-constantexpr.ll
index 416367fa3b52a..6e6a0c18d92d5 100644
--- a/llvm/test/CodeGen/Generic/vector-constantexpr.ll
+++ b/llvm/test/CodeGen/Generic/vector-constantexpr.ll
@@ -1,6 +1,6 @@
; RUN: llc < %s
-define void @""(ptr %inregs, ptr %outregs) {
+define void @test(ptr %inregs, ptr %outregs) {
%a_addr.i = alloca <4 x float> ; <ptr> [#uses=1]
store <4 x float> < float undef, float undef, float undef, float undef >, ptr %a_addr.i
ret void
|
LLVM supports unnamed global variables and function; if such a function actually needs a name, we invent one later. (See Mangler::getNameWithPrefix.) Not really that useful, or frequently used, but it's there. I guess we can make AArch64Arm64ECCallLowering introduce names if they're necessary. If you're not going to fix it, please open a bug. Please split out the available_externally fix, with an appropriate testcase. |
While testing Arm64EC, I observed that LLVM crashes when an `available_externally` function is used as it tries to place it in a COMDAT, which is not permitted by the verifier. This the fix from #151409 plus a dedicated test.
While testing Arm64EC, I observed that LLVM crashes when an empty function name is used. My original fix in #151409 was to raise an error, but this change now handles the empty name via `Mangler::getNameWithPrefix` (which assigns a name to the function). To get this working, I had to create the `Mangler` in `TargetLoweringObjectFile` early so it would be available to Arm64EC's lowering. There's no reason why `Mangler` is only created when `Initialize` is called (or re-created if it exists), and so I moved creation to the constructor and switched the raw pointer for a `unique_ptr` to avoid the explicit `delete` in the destructor.
7e8eaa5
to
3ebade3
Compare
Both of these have been fixed in other PRs, so this PR is ready to land now. |
tools/llvm-objcopy/MachO/update-section-object.test
was failing on Windows since the input file (macho_sections.s
) might be checked out with the wrong line ending, resulting in difference in the size of sections being checked.AArch64Arm64ECCallLowering
: whenllc
is run without an explicit target, the module's target triple is unknown so this assert fires.llvm/test/CodeGen/Generic/allow-check.ll
to fail for Arm64EC: Global ISel is not supported.