1 ; RUN: llc %s -o - -verify-machineinstrs | FileCheck %s 2 3 target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32" 4 target triple = "thumbv7s-apple-ios8.0.0" 5 6 @debw = external global i8*, align 4 7 8 ; This test ensures that the stack_chk call correctly puts implicit uses/defs for the regsiters 9 ; live across it when if converting. This will be R0 which is passed to the call to free at the end 10 ; of the function. 11 ; Prior to this change, the stack_chk call (which does not return) would clobber R0 in its regmask, 12 ; leading to verifier errors because the later use of R0 in free() is not live. 13 14 ; CHECK-LABEL: @test 15 ; CHECK: stack_chk_fail 16 17 ; Function Attrs: ssp 18 define void @test(i32 %argc, i8** nocapture readonly %argv, i32* %ptr, i32 %val) #0 { 19 entry: 20 %count.i = alloca [256 x i32], align 4 21 %cmp284.i = icmp eq i32 %val, 0 22 br i1 %cmp284.i, label %for.end31.i, label %for.body21.i 23 24 for.body21.i: ; preds = %entry 25 %arrayidx23.i = getelementptr inbounds [256 x i32], [256 x i32]* %count.i, i32 0, i32 1 26 %tmp20 = load i32, i32* %arrayidx23.i, align 4, !tbaa !0 27 store i32 %tmp20, i32* %ptr, align 4, !tbaa !0 28 br label %for.end31.i 29 30 for.end31.i: ; preds = %for.body21.i, %entry 31 %tmp21 = load i8*, i8** @debw, align 4, !tbaa !4 32 tail call void @free(i8* %tmp21) 33 ret void 34 } 35 36 declare void @free(i8* nocapture) 37 38 attributes #0 = { ssp "stack-protector-buffer-size"="8" } 39 40 !0 = !{!1, !1, i64 0} 41 !1 = !{!"int", !2, i64 0} 42 !2 = !{!"omnipotent char", !3, i64 0} 43 !3 = !{!"Simple C/C++ TBAA"} 44 !4 = !{!5, !5, i64 0} 45 !5 = !{!"any pointer", !2, i64 0} 46