1 ; RUN: opt < %s -basicaa -dse -S | FileCheck %s 2 3 target datalayout = "e-p:64:64:64" 4 5 ; CHECK: @test 6 ; CHECK-NEXT: bitcast 7 ; CHECK-NEXT: @free 8 ; CHECK-NEXT: ret void 9 define void @test(i32* %Q, i32* %P) { 10 %DEAD = load i32* %Q ; <i32> [#uses=1] 11 store i32 %DEAD, i32* %P 12 %1 = bitcast i32* %P to i8* 13 tail call void @free(i8* %1) 14 ret void 15 } 16 17 ; CHECK: @test2 18 ; CHECK-NEXT: bitcast 19 ; CHECK-NEXT: @free 20 ; CHECK-NEXT: ret void 21 define void @test2({i32, i32}* %P) { 22 %Q = getelementptr {i32, i32} *%P, i32 0, i32 1 23 store i32 4, i32* %Q 24 %1 = bitcast {i32, i32}* %P to i8* 25 tail call void @free(i8* %1) 26 ret void 27 } 28 29 ; CHECK: @test4 30 ; CHECK-NOT: store 31 ; CHECK: ret void 32 define void @test4() { 33 %m = call i8* @malloc(i64 24) 34 store i8 0, i8* %m 35 %m1 = getelementptr i8* %m, i64 1 36 store i8 1, i8* %m1 37 call void @free(i8* %m) 38 ret void 39 } 40 41 declare void @free(i8*) 42 declare i8* @malloc(i64) 43