
As of rev ea222be0d, LLVMs assembler will actually try to honour the "fill value" part of p2align directives. X86 printed these as 0x90, which isn't actually what it wanted: we want multi-byte nops for .text padding. Compiling via a textual assembly file produces single-byte nop padding since ea222be0d but the built-in assembler will produce multi-byte nops. This divergent behaviour is undesirable. To fix: don't set the byte padding field for x86, which allows the assembler to pick multi-byte nops. Test that we get the same multi-byte padding when compiled via textual assembly or directly to object file. Added same-align-bytes-with-llasm-llobj.ll to that effect, updated numerous other tests to not contain check-lines for the explicit padding.
47 lines
1.6 KiB
LLVM
47 lines
1.6 KiB
LLVM
; RUN: llc %s -o - -filetype=obj --mcpu=znver2 | llvm-objdump -dr - | FileCheck %s
|
|
; RUN: llc %s -o - -filetype=asm --mcpu=znver2 | llvm-mc - -o - --mcpu=znver2 -filetype=obj -triple x86_64-unknown-linux-gnu | llvm-objdump -dr - | FileCheck %s
|
|
; RUN: llc %s -o - -filetype=asm --mcpu=znver2 | FileCheck %s --check-prefix=ASM
|
|
|
|
;; Check that we produce a push, then an align-to-16-bytes p2align.
|
|
;
|
|
; ASM: # %bb.0:
|
|
; ASM-NEXT: pushq %rax
|
|
; ASM-NEXT: .cfi_def_cfa_offset 16
|
|
; ASM-NEXT: .p2align 4{{$}}
|
|
|
|
;; When we assemble the file, either using the built-in asssembler or going
|
|
;; via a textual assembly file, we should get the same padding between the
|
|
;; initial push and the next block for alignment. It's a single 15 byte
|
|
;; nop.
|
|
|
|
; CHECK: 0: 50
|
|
; CHECK-NEXT: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:(%rax,%rax)
|
|
|
|
;; Note that we specify a CPU to ensure the same nop patterns are selected
|
|
;; between llvm-mc and llc, just in case defaults changed, which one isn't
|
|
;; important.
|
|
|
|
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
; Function Attrs: noreturn nounwind uwtable
|
|
define dso_local void @b() local_unnamed_addr {
|
|
entry:
|
|
br label %for.cond
|
|
|
|
for.cond:
|
|
tail call void (...) @a()
|
|
br label %for.cond
|
|
}
|
|
|
|
declare void @a(...) local_unnamed_addr
|
|
|
|
!llvm.module.flags = !{!0, !1, !2, !3}
|
|
!llvm.ident = !{!4}
|
|
|
|
!0 = !{i32 1, !"wchar_size", i32 4}
|
|
!1 = !{i32 8, !"PIC Level", i32 2}
|
|
!2 = !{i32 7, !"PIE Level", i32 2}
|
|
!3 = !{i32 7, !"uwtable", i32 2}
|
|
!4 = !{!"clang"}
|