1 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 define i32 @main(i32 %argc, i8** %argv) {
5 %malloc_206 = tail call i8* @malloc(i32 mul (i32 ptrtoint (i8* getelementptr (i8* null, i32 1) to i32), i32 10))
6 store i8* %malloc_206, i8** %c_19
7 %tmp_207 = load i8** %c_19
8 tail call void @free(i8* %tmp_207)
15 declare noalias i8* @malloc(i32)
16 declare void @free(i8*)
20 ; CHECK-NEXT: ret i1 false
21 %m = call i8* @malloc(i32 1)
22 %z = icmp eq i8* %m, null
23 call void @free(i8* %m)
27 declare void @llvm.lifetime.start(i64, i8*)
28 declare void @llvm.lifetime.end(i64, i8*)
30 define void @test3() {
32 ; CHECK-NEXT: ret void
33 %a = call noalias i8* @malloc(i32 10)
34 call void @llvm.lifetime.start(i64 10, i8* %a)
35 call void @llvm.lifetime.end(i64 10, i8* %a)
39 ;; This used to crash.
40 define void @test4() {
42 ; CHECK-NEXT: ret void
43 %A = call i8* @malloc(i32 16000)
44 %B = bitcast i8* %A to double*
45 %C = bitcast double* %B to i8*
46 call void @free(i8* %C)