1 ; RUN: opt < %s -basicaa -dse -S | FileCheck %s
3 target datalayout = "e-p:64:64:64"
5 declare void @free(i8* nocapture)
6 declare noalias i8* @malloc(i64)
11 ; CHECK-NEXT: ret void
12 define void @test(i32* %Q, i32* %P) {
13 %DEAD = load i32, i32* %Q ; <i32> [#uses=1]
14 store i32 %DEAD, i32* %P
15 %1 = bitcast i32* %P to i8*
16 tail call void @free(i8* %1) nounwind
20 ; CHECK-LABEL: @test2(
23 ; CHECK-NEXT: ret void
24 define void @test2({i32, i32}* %P) {
25 %Q = getelementptr {i32, i32}, {i32, i32} *%P, i32 0, i32 1
27 %1 = bitcast {i32, i32}* %P to i8*
28 tail call void @free(i8* %1) nounwind
32 ; CHECK-LABEL: @test3(
35 define void @test3() {
36 %m = call i8* @malloc(i64 24)
38 %m1 = getelementptr i8, i8* %m, i64 1
40 call void @free(i8* %m) nounwind
45 ; CHECK-LABEL: @test4(
48 define void @test4(i1 %x) nounwind {
50 %alloc1 = tail call noalias i8* @malloc(i64 4) nounwind
51 br i1 %x, label %skipinit1, label %init1
54 store i8 1, i8* %alloc1
58 tail call void @free(i8* %alloc1) nounwind
62 ; CHECK-LABEL: @test5(
63 define void @test5() {
67 tail call void @free(i8* undef) nounwind