1 ; RUN: llc < %s -mtriple x86_64-apple-darwin11 -mcpu corei7 -filetype=obj -o - | llvm-objdump -d -unwind-info -s - | FileCheck %s
2 ; Regression test for http://llvm.org/bugs/show_bug.cgi?id=20800.
4 ; ModuleID = 'asan_report.ii'
5 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-apple-macosx10.9.0"
8 @.str = private unnamed_addr constant [3 x i8] c"=>\00", align 1
9 @.str1 = private unnamed_addr constant [3 x i8] c" \00", align 1
10 @.str2 = private unnamed_addr constant [6 x i8] c"%s%p:\00", align 1
12 ; CHECK: ___asan_report_error:
14 ; subq instruction starts at 0x0a, so the second byte of the compact encoding
15 ; (UNWIND_X86_64_FRAMELESS_STACK_SIZE in mach-o/compact_unwind_encoding.h)
17 ; CHECK: {{a:.*subq.*%rsp}}
19 ; CHECK: Contents of __compact_unwind section
20 ; CHECK: ___asan_report_error
22 ; Because of incorrect push instruction size in X86AsmBackend.cpp the stack
23 ; size was also calculated incorrectly.
24 ; CHECK-NOT: {{compact encoding:.*0x0309f800}}
25 ; CHECK: {{compact encoding:.*0x030df800}}
27 define void @__asan_report_error() #0 {
28 %str.i = alloca i64, align 8
29 %stack = alloca [256 x i64], align 8
30 br label %print_shadow_bytes.exit.i
32 print_shadow_bytes.exit.i: ; preds = %print_shadow_bytes.exit.i, %0
33 %iv.i = phi i64 [ -5, %0 ], [ %iv.next.i, %print_shadow_bytes.exit.i ]
34 %reg15 = icmp eq i64 %iv.i, 0
35 %.str..str1.i = select i1 %reg15, [3 x i8]* @.str, [3 x i8]* @.str1
36 %reg16 = getelementptr inbounds [3 x i8], [3 x i8]* %.str..str1.i, i64 0, i64 0
37 %reg17 = shl i64 %iv.i, 1
38 %reg19 = inttoptr i64 %reg17 to i8*
39 call void (i64*, i8*, ...) @append(i64* %str.i, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str2, i64 0, i64 0), i8* %reg16, i8* %reg19)
40 %iv.next.i = add nsw i64 %iv.i, 0
41 br label %print_shadow_bytes.exit.i
44 declare void @append(i64*, i8*, ...)
46 attributes #0 = { "no-frame-pointer-elim"="false" }