1 ; RUN: opt < %s -instcombine -S | FileCheck %s 2 ; <rdar://problem/9815881> 3 ; On OSX x86-32, fwrite and fputs aren't called fwrite and fputs. 4 ; Make sure we use the correct names. 5 6 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128" 7 target triple = "i386-apple-macosx10.7.2" 8 9 %struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } 10 %struct.__sbuf = type { i8*, i32 } 11 %struct.__sFILEX = type opaque 12 13 @.str = private unnamed_addr constant [13 x i8] c"Hello world\0A\00", align 1 14 @.str2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 15 16 define void @test1(%struct.__sFILE* %stream) nounwind { 17 ; CHECK-LABEL: define void @test1( 18 ; CHECK: call i32 @"fwrite$UNIX2003" 19 %call = tail call i32 (%struct.__sFILE*, i8*, ...) @fprintf(%struct.__sFILE* %stream, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0)) nounwind 20 ret void 21 } 22 23 define void @test2(%struct.__sFILE* %stream, i8* %str) nounwind ssp { 24 ; CHECK-LABEL: define void @test2( 25 ; CHECK: call i32 @"fputs$UNIX2003" 26 %call = tail call i32 (%struct.__sFILE*, i8*, ...) @fprintf(%struct.__sFILE* %stream, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str2, i32 0, i32 0), i8* %str) nounwind 27 ret void 28 } 29 30 declare i32 @fprintf(%struct.__sFILE*, i8*, ...) nounwind 31