1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -instcombine -S | FileCheck %s 3 4%struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] } 5%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 } 6 7@stderr = external global %struct._IO_FILE*, align 8 8@.str = private constant [8 x i8] c"crash!\0A\00", align 1 9 10@fwrite = alias i64 (i8*, i64, i64, %struct._IO_FILE*), i64 (i8*, i64, i64, %struct._IO_FILE*)* @__fwrite_alias 11 12define i64 @__fwrite_alias(i8* %ptr, i64 %size, i64 %n, %struct._IO_FILE* %s) { 13; CHECK-LABEL: @__fwrite_alias( 14; CHECK-NEXT: entry: 15; CHECK-NEXT: ret i64 0 16; 17entry: 18 %ptr.addr = alloca i8*, align 8 19 %size.addr = alloca i64, align 8 20 %n.addr = alloca i64, align 8 21 %s.addr = alloca %struct._IO_FILE*, align 8 22 store i8* %ptr, i8** %ptr.addr, align 8 23 store i64 %size, i64* %size.addr, align 8 24 store i64 %n, i64* %n.addr, align 8 25 store %struct._IO_FILE* %s, %struct._IO_FILE** %s.addr, align 8 26 ret i64 0 27} 28 29define void @foo() { 30; CHECK-LABEL: @foo( 31; CHECK-NEXT: entry: 32; CHECK-NEXT: [[TMP0:%.*]] = load %struct._IO_FILE*, %struct._IO_FILE** @stderr, align 8 33; CHECK-NEXT: [[TMP1:%.*]] = call i64 @__fwrite_alias(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 7, i64 1, %struct._IO_FILE* [[TMP0]]) 34; CHECK-NEXT: ret void 35; 36entry: 37 %retval = alloca i32, align 4 38 store i32 0, i32* %retval, align 4 39 %0 = load %struct._IO_FILE*, %struct._IO_FILE** @stderr, align 8 40 %call = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)) 41 ret void 42} 43 44declare i32 @fprintf(%struct._IO_FILE*, i8*, ...) 45