Files
clang-p2996/llvm/test/CodeGen/MIR/X86/expected-stack-object.mir
Fangrui Song 40a4cbb0f2 [MIR,test] Change llc -march=x86-64 to -mtriple=x86_64
Similar to 806761a762

-mtriple= specifies the full target triple while -march= merely sets the
architecture part of the default target triple (e.g. Windows, macOS).

Therefore, -march= is error-prone and not recommended for tests without
a target triple. The issue has been benign as these MIR tests do not
utilize object file format specific detail, but it's good to change
these tests to neighbor files that use -mtriple=x86_64
2024-12-15 11:23:08 -08:00

68 lines
2.3 KiB
YAML

# RUN: not llc -mtriple=x86_64 -run-pass none -o /dev/null %s 2>&1 | FileCheck %s
--- |
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@__stack_chk_guard = external global ptr
define i32 @test() #0 {
entry:
%StackGuardSlot = alloca ptr
%StackGuard = load ptr, ptr @__stack_chk_guard
call void @llvm.stackprotector(ptr %StackGuard, ptr %StackGuardSlot)
%test = alloca ptr, align 8
%a = alloca i8, i64 5
store ptr %a, ptr %test, align 8
%b = load ptr, ptr %test, align 8
%call = call i32 (ptr, ...) @printf(ptr @.str, ptr %b)
call void @llvm.stackprotectorcheck(ptr @__stack_chk_guard)
ret i32 %call
}
declare i32 @printf(ptr, ...)
declare void @llvm.stackprotector(ptr, ptr) #1
declare void @llvm.stackprotectorcheck(ptr) #2
attributes #0 = { ssp "stack-protector-buffer-size"="5" }
attributes #1 = { nounwind }
attributes #2 = { nounwind argmemonly }
...
---
name: test
alignment: 16
tracksRegLiveness: true
frameInfo:
stackSize: 40
maxAlignment: 8
adjustsStack: true
hasCalls: true
# CHECK: [[@LINE+1]]:21: expected a stack object
stackProtector: '0'
fixedStack:
- { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16,
callee-saved-register: '$rbx' }
stack:
- { id: 0, name: StackGuardSlot, offset: -24, size: 8, alignment: 8 }
- { id: 1, name: test, offset: -40, size: 8, alignment: 8 }
- { id: 2, name: a, offset: -29, size: 5, alignment: 1 }
body: |
bb.0.entry:
liveins: $rbx, $rbx
frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
$rsp = frame-setup SUB64ri8 $rsp, 32, implicit-def dead $eflags
$rbx = LOAD_STACK_GUARD :: (invariant load 8 from %ir.__stack_chk_guard)
MOV64mr $rsp, 1, _, 24, _, $rbx
$rsi = LEA64r $rsp, 1, _, 19, _
MOV64mr $rsp, 1, _, 8, _, $rsi
$rdi = LEA64r $rip, 1, _, @.str, _
dead $eax = MOV32r0 implicit-def dead $eflags, implicit-def $al
CALL64pcrel32 @printf, csr_64, implicit $rsp, implicit $rdi, implicit $rsi, implicit $al, implicit-def $rsp, implicit-def $eax
CMP64rm killed $rbx, $rsp, 1, _, 24, _, implicit-def $eflags
$rsp = ADD64ri8 $rsp, 32, implicit-def dead $eflags
$rbx = POP64r implicit-def $rsp, implicit $rsp
RET64 $eax
...