1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -S | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker; <rdar://problem/9815881> 3*9880d681SAndroid Build Coastguard Worker; On OSX x86-32, fwrite and fputs aren't called fwrite and fputs. 4*9880d681SAndroid Build Coastguard Worker; Make sure we use the correct names. 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Workertarget 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*9880d681SAndroid Build Coastguard Workertarget triple = "i386-apple-macosx10.7.2" 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker%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*9880d681SAndroid Build Coastguard Worker%struct.__sbuf = type { i8*, i32 } 11*9880d681SAndroid Build Coastguard Worker%struct.__sFILEX = type opaque 12*9880d681SAndroid Build Coastguard Worker 13*9880d681SAndroid Build Coastguard Worker@.str = private unnamed_addr constant [13 x i8] c"Hello world\0A\00", align 1 14*9880d681SAndroid Build Coastguard Worker@.str2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Workerdefine void @test1(%struct.__sFILE* %stream) nounwind { 17*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @test1( 18*9880d681SAndroid Build Coastguard Worker; CHECK: call i32 @"fwrite$UNIX2003" 19*9880d681SAndroid Build Coastguard Worker %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*9880d681SAndroid Build Coastguard Worker ret void 21*9880d681SAndroid Build Coastguard Worker} 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Workerdefine void @test2(%struct.__sFILE* %stream, i8* %str) nounwind ssp { 24*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @test2( 25*9880d681SAndroid Build Coastguard Worker; CHECK: call i32 @"fputs$UNIX2003" 26*9880d681SAndroid Build Coastguard Worker %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*9880d681SAndroid Build Coastguard Worker ret void 28*9880d681SAndroid Build Coastguard Worker} 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Workerdeclare i32 @fprintf(%struct.__sFILE*, i8*, ...) nounwind 31