1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
4 target triple = "x86_64-apple-darwin10.0.0"
6 define void @func(i8* %i) nounwind ssp {
9 ; CHECK-NEXT: [[S:%.*]] = alloca [32 x i8], align 16
10 ; CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [32 x i8], [32 x i8]* [[S]], i64 0, i64 0
11 ; CHECK-NEXT: [[CALL:%.*]] = call i8* @__strcpy_chk(i8* nonnull [[ARRAYDECAY]], i8* [[I:%.*]], i64 32)
12 ; CHECK-NEXT: call void @func2(i8* nonnull [[ARRAYDECAY]]) [[ATTR2:#.*]]
13 ; CHECK-NEXT: ret void
16 %s = alloca [32 x i8], align 16
17 %arraydecay = getelementptr inbounds [32 x i8], [32 x i8]* %s, i32 0, i32 0
18 %call = call i8* @__strcpy_chk(i8* %arraydecay, i8* %i, i64 32)
19 call void @func2(i8* %arraydecay)
23 define void @func_no_null_opt(i8* %i) nounwind ssp #0 {
24 ; CHECK-LABEL: @func_no_null_opt(
26 ; CHECK-NEXT: [[S:%.*]] = alloca [32 x i8], align 16
27 ; CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [32 x i8], [32 x i8]* [[S]], i64 0, i64 0
28 ; CHECK-NEXT: [[CALL:%.*]] = call i8* @__strcpy_chk(i8* [[ARRAYDECAY]], i8* [[I:%.*]], i64 32)
29 ; CHECK-NEXT: call void @func2(i8* [[ARRAYDECAY]]) [[ATTR2]]
30 ; CHECK-NEXT: ret void
33 %s = alloca [32 x i8], align 16
34 %arraydecay = getelementptr inbounds [32 x i8], [32 x i8]* %s, i32 0, i32 0
35 %call = call i8* @__strcpy_chk(i8* %arraydecay, i8* %i, i64 32)
36 call void @func2(i8* %arraydecay)
40 declare i8* @__strcpy_chk(i8*, i8*, i64) nounwind
42 declare void @func2(i8*)
44 attributes #0 = { null_pointer_is_valid }