1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/AArch64/branch-relax-cbz.ll
Diogo N. Sampaio 82cb0e3bb0 [FIX] Forces shrink wrapping to consider any memory access as aliasing with the stack
Summary:
Relate bug: https://bugs.llvm.org/show_bug.cgi?id=37472

The shrink wrapping pass prematurally restores the stack, at a point where the stack might still be accessed.
Taking an exception can cause the stack to be corrupted.

As a first approach, this patch is overly conservative, assuming that any instruction that may load or store could access
the stack.

Reviewers: dmgreen, qcolombet

Reviewed By: qcolombet

Subscribers: simpal01, efriedma, eli.friedman, javed.absar, llvm-commits, eugenis, chill, carwil, thegameg

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63152

llvm-svn: 363265
2019-06-13 13:56:19 +00:00

51 lines
1.3 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=aarch64-apple-darwin -aarch64-cbz-offset-bits=3 < %s | FileCheck %s
define void @split_block_no_fallthrough(i64 %val) #0 {
; CHECK-LABEL: split_block_no_fallthrough:
; CHECK: ; %bb.0: ; %bb
; CHECK-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
; CHECK-NEXT: cmn x0, #5 ; =5
; CHECK-NEXT: b.le LBB0_3
; CHECK-NEXT: ; %bb.1: ; %b3
; CHECK-NEXT: ldr w8, [x8]
; CHECK-NEXT: cbnz w8, LBB0_2
; CHECK-NEXT: b LBB0_4
; CHECK-NEXT: LBB0_2: ; %b8
; CHECK-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
; CHECK-NEXT: ret
; CHECK-NEXT: LBB0_3: ; %b2
; CHECK-NEXT: mov w0, #93
; CHECK-NEXT: bl _extfunc
; CHECK-NEXT: cbnz w0, LBB0_2
; CHECK-NEXT: LBB0_4: ; %b7
; CHECK-NEXT: mov w0, #13
; CHECK-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
; CHECK-NEXT: b _extfunc
bb:
%c0 = icmp sgt i64 %val, -5
br i1 %c0, label %b3, label %b2
b2:
%v0 = tail call i32 @extfunc(i32 93)
%c1 = icmp eq i32 %v0, 0
br i1 %c1, label %b7, label %b8
b3:
%v1 = load volatile i32, i32* undef, align 4
%c2 = icmp eq i32 %v1, 0
br i1 %c2, label %b7, label %b8
b7:
%tmp1 = tail call i32 @extfunc(i32 13)
ret void
b8:
ret void
}
declare i32 @extfunc(i32) #0
attributes #0 = { nounwind }