llvm-project/llvm/test/CodeGen/X86/GlobalISel/stacksave-stackrestore.ll
Mahesh-Attarde 05a34dde70
[X86][GISEL] Enable Pre Legalizer Combiner (#173220)
This patch enables Pre-legalization Combiner for X86 Target. It includes
basic bring up with intent to cover non-regressing support from
all_combines.

continuing from https://github.com/llvm/llvm-project/pull/172204.
2025-12-28 15:59:44 +00:00

39 lines
1.2 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
; RUN: llc -global-isel=1 -mtriple=x86_64-linux-gnu -o - %s | FileCheck %s
declare void @use_addr(ptr)
declare ptr @llvm.stacksave.p0()
declare void @llvm.stackrestore.p0(ptr)
define void @test_scoped_alloca(i64 %n) {
; CHECK-LABEL: test_scoped_alloca:
; CHECK: # %bb.0:
; CHECK-NEXT: pushq %rbp
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset %rbp, -16
; CHECK-NEXT: movq %rsp, %rbp
; CHECK-NEXT: .cfi_def_cfa_register %rbp
; CHECK-NEXT: pushq %rbx
; CHECK-NEXT: pushq %rax
; CHECK-NEXT: .cfi_offset %rbx, -24
; CHECK-NEXT: movq %rsp, %rbx
; CHECK-NEXT: movq %rsp, %rax
; CHECK-NEXT: addq $15, %rdi
; CHECK-NEXT: andq $-16, %rdi
; CHECK-NEXT: subq %rdi, %rax
; CHECK-NEXT: movq %rax, %rsp
; CHECK-NEXT: movq %rax, %rdi
; CHECK-NEXT: callq use_addr
; CHECK-NEXT: movq %rbx, %rsp
; CHECK-NEXT: leaq -8(%rbp), %rsp
; CHECK-NEXT: popq %rbx
; CHECK-NEXT: popq %rbp
; CHECK-NEXT: .cfi_def_cfa %rsp, 8
; CHECK-NEXT: retq
%sp = call ptr @llvm.stacksave.p0()
%addr = alloca i8, i64 %n
call void @use_addr(ptr %addr)
call void @llvm.stackrestore.p0(ptr %sp)
ret void
}