Skip to content

Commit 96bbb72

Browse files
drop -enable-split-machine-functions in test case, and add back `const
auto& DL = MF->getDataLayout()`.
1 parent 8a09ec1 commit 96bbb72

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2913,7 +2913,8 @@ void AsmPrinter::emitJumpTableImpl(const MachineJumpTableInfo &MJTI,
29132913
OutStreamer->switchSection(JumpTableSection);
29142914
}
29152915

2916-
emitAlignment(Align(MJTI.getEntryAlignment(MF->getDataLayout())));
2916+
const DataLayout &DL = MF->getDataLayout();
2917+
emitAlignment(Align(MJTI.getEntryAlignment(DL)));
29172918

29182919
// Jump tables in code sections are marked with a data_region directive
29192920
// where that's supported.
@@ -2952,7 +2953,7 @@ void AsmPrinter::emitJumpTableImpl(const MachineJumpTableInfo &MJTI,
29522953
// before each jump table. The first label is never referenced, but tells
29532954
// the assembler and linker the extents of the jump table object. The
29542955
// second label is actually referenced by the code.
2955-
if (JTInDiffSection && MF->getDataLayout().hasLinkerPrivateGlobalPrefix())
2956+
if (JTInDiffSection && DL.hasLinkerPrivateGlobalPrefix())
29562957
// FIXME: This doesn't have to have any specific name, just any randomly
29572958
// named and numbered local label started with 'l' would work. Simplify
29582959
// GetJTISymbol.

llvm/test/CodeGen/AArch64/jump-table-partition.ll

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,24 @@
1919
; DEFAULT: .section .rodata.bar_prefix.bar,"a",@progbits
2020
; DEFAULT: .LJTI2_0
2121

22-
; RUN: llc -mtriple=aarch64-unknown-linux-gnu -enable-split-machine-functions \
23-
; RUN: -partition-static-data-sections=true -function-sections=true \
22+
; Test that section names are uniqufied by numbers but not function names with
23+
; {-function-sections, -unique-section-names=false}. Specifically, @foo jump
24+
; tables are emitted in two sections, one with unique ID 2 and the other with
25+
; unique ID 3.
26+
; RUN: llc -mtriple=aarch64-unknown-linux-gnu -partition-static-data-sections \
27+
; RUN: -function-sections -unique-section-names=false \
2428
; RUN: -aarch64-enable-atomic-cfg-tidy=false -aarch64-min-jump-table-entries=2 \
25-
; RUN: -unique-section-names=false %s -o - 2>&1 | FileCheck %s --check-prefixes=NUM,JT
29+
; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=NUM,JT
2630

27-
; Section names will optionally have `.<func>` if -function-sections is enabled.
28-
; RUN: llc -mtriple=aarch64-unknown-linux-gnu -enable-split-machine-functions \
29-
; RUN: -partition-static-data-sections=true -function-sections=true \
31+
; Section names will optionally have `.<func>` with {-function-sections, -unique-section-names}.
32+
; RUN: llc -mtriple=aarch64-unknown-linux-gnu -partition-static-data-sections \
33+
; RUN: -function-sections -unique-section-names \
3034
; RUN: -aarch64-enable-atomic-cfg-tidy=false -aarch64-min-jump-table-entries=2 \
3135
; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNC,JT
3236

33-
; RUN: llc -mtriple=aarch64-unknown-linux-gnu -enable-split-machine-functions \
34-
; RUN: -partition-static-data-sections=true -function-sections=false \
37+
; Test that section names won't have `.<func>` with -function-sections=false.
38+
; RUN: llc -mtriple=aarch64-unknown-linux-gnu -partition-static-data-sections \
39+
; RUN: -function-sections=false \
3540
; RUN: -aarch64-enable-atomic-cfg-tidy=false -aarch64-min-jump-table-entries=2 \
3641
; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNCLESS,JT
3742

0 commit comments

Comments
 (0)