Skip to content

Commit 40aca0e

Browse files
author
git apple-llvm automerger
committed
Merge commit '1090b91a2840' from llvm.org/release/17.x into stable/20230725
2 parents 066c96c + 1090b91 commit 40aca0e

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

llvm/lib/MC/MCWin64EH.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,9 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info,
14021402
// here, but we'd have to emit the pdata, the xdata header, and the
14031403
// epilogue scopes later, since they depend on whether the we need to
14041404
// split the unwind data.
1405+
//
1406+
// If this is fixed, remove code in AArch64ISelLowering.cpp that
1407+
// disables loop alignment on Windows.
14051408
RawFuncLength = GetAbsDifference(streamer, info->FuncletOrFuncEnd,
14061409
info->Begin);
14071410
}

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,12 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
10391039
// Set required alignment.
10401040
setMinFunctionAlignment(Align(4));
10411041
// Set preferred alignments.
1042-
setPrefLoopAlignment(STI.getPrefLoopAlignment());
1042+
1043+
// Don't align loops on Windows. The SEH unwind info generation needs to
1044+
// know the exact length of functions before the alignments have been
1045+
// expanded.
1046+
if (!Subtarget->isTargetWindows())
1047+
setPrefLoopAlignment(STI.getPrefLoopAlignment());
10431048
setMaxBytesForAlignment(STI.getMaxBytesForLoopAlignment());
10441049
setPrefFunctionAlignment(STI.getPrefFunctionAlignment());
10451050

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc < %s -mtriple=aarch64-windows | FileCheck %s --check-prefix=WINDOWS
2+
; RUN: llc < %s -mtriple=aarch64-linux | FileCheck %s --check-prefix=LINUX
3+
4+
define dso_local void @b() #0 {
5+
entry:
6+
br label %for.cond
7+
8+
for.cond:
9+
tail call void @a()
10+
br label %for.cond
11+
}
12+
13+
declare dso_local void @a(...)
14+
15+
attributes #0 = { noreturn nounwind uwtable "tune-cpu"="cortex-a53" }
16+
17+
; LINUX-LABEL: b:
18+
; LINUX: .p2align 4
19+
20+
; WINDOWS-LABEL: b:
21+
; WINDOWS-NOT: .p2align

0 commit comments

Comments
 (0)