[PATCH] D15774: [PEI] Calculate stack protector frame offset before local stack allocation.
Geoff Berry via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 10 11:49:19 PST 2016
gberry added a comment.
This change seems reasonable to me. I don't think the test is quite right, specifically the CHECK line checking the store of the canary value. I don't think the issue is whether it is being stored relative to the frame pointer or stack pointer, but rather where on the stack it is being stored in relation to the local variables. The below test is simpler and hopefully captures more of the constraints we'd like to verify, though it may be more sensitive to codegen changes.
; RUN: llc -mtriple aarch64--linux < %s | FileCheck %s
; CHECK-LABEL: test:
; Make sure the canary is placed just above the alloca on the stack.
; CHECK: stp {{x[0-9]+}}, {{x[0-9]+}}, [sp, #-32]!
; CHECK: add x29, sp, #16
; CHECK-NEXT: sub sp, sp, #8, lsl #12
; CHECK: ldr [[GUARD:x[0-9]+]]{{.*}}:lo12:__stack_chk_guard
; CHECK: sub [[GUARDADDR:x[0-9]+]], x29, #32
; CHECK-NEXT: str [[GUARD]], {{\[}}[[GUARDADDR]]]
; CHECK-NEXT: str x0, [sp, #-16]!
; Function Attrs: ssp
define void @test(i64 %x) #0 {
entry:
%buf = alloca i64, i32 4096, align 8
%idx = getelementptr inbounds i64, i64* %buf, i64 0
store i64 %x, i64* %idx, align 8
ret void
}
attributes #0 = { ssp }
Repository:
rL LLVM
http://reviews.llvm.org/D15774
More information about the llvm-commits
mailing list