16877ef70a310404f59de7fdf22c919275c52e30
[oota-llvm.git] / test / CodeGen / X86 / stack-protector-weight.ll
1 ; RUN: llc -mtriple=x86_64-apple-darwin -print-machineinstrs=expand-isel-pseudos -enable-selectiondag-sp=true %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=SELDAG
2 ; RUN: llc -mtriple=x86_64-apple-darwin -print-machineinstrs=expand-isel-pseudos -enable-selectiondag-sp=false %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=IR
3
4 ; SELDAG: # Machine code for function test_branch_weights:
5 ; SELDAG: Successors according to CFG: BB#[[SUCCESS:[0-9]+]](2147481600) BB#[[FAILURE:[0-9]+]](2048)
6 ; SELDAG: BB#[[FAILURE]]:
7 ; SELDAG: CALL64pcrel32 <es:__stack_chk_fail>
8 ; SELDAG: BB#[[SUCCESS]]:
9
10 ; IR: # Machine code for function test_branch_weights:
11 ; IR: Successors according to CFG: BB#[[SUCCESS:[0-9]+]](2147481600) BB#[[FAILURE:[0-9]+]](2048)
12 ; IR: BB#[[SUCCESS]]:
13 ; IR: BB#[[FAILURE]]:
14 ; IR: CALL64pcrel32 <ga:@__stack_chk_fail>
15
16 define i32 @test_branch_weights(i32 %n) #0 {
17 entry:
18   %a = alloca [128 x i32], align 16
19   %0 = bitcast [128 x i32]* %a to i8*
20   call void @llvm.lifetime.start(i64 512, i8* %0)
21   %arraydecay = getelementptr inbounds [128 x i32], [128 x i32]* %a, i64 0, i64 0
22   call void @foo2(i32* %arraydecay)
23   %idxprom = sext i32 %n to i64
24   %arrayidx = getelementptr inbounds [128 x i32], [128 x i32]* %a, i64 0, i64 %idxprom
25   %1 = load i32, i32* %arrayidx, align 4
26   call void @llvm.lifetime.end(i64 512, i8* %0)
27   ret i32 %1
28 }
29
30 declare void @llvm.lifetime.start(i64, i8* nocapture)
31
32 declare void @foo2(i32*)
33
34 declare void @llvm.lifetime.end(i64, i8* nocapture)
35
36 attributes #0 = { ssp "stack-protector-buffer-size"="8" }