2010-11-12 02:02:39 +00:00
|
|
|
; RUN: opt < %s -basicaa -dse -S | FileCheck %s
|
2004-07-25 07:57:50 +00:00
|
|
|
|
2010-11-12 02:02:39 +00:00
|
|
|
target datalayout = "e-p:64:64:64"
|
|
|
|
|
|
|
|
; CHECK: @test
|
|
|
|
; CHECK-NEXT: bitcast
|
|
|
|
; CHECK-NEXT: @free
|
|
|
|
; CHECK-NEXT: ret void
|
2008-03-01 09:15:35 +00:00
|
|
|
define void @test(i32* %Q, i32* %P) {
|
|
|
|
%DEAD = load i32* %Q ; <i32> [#uses=1]
|
|
|
|
store i32 %DEAD, i32* %P
|
|
|
|
free i32* %P
|
|
|
|
ret void
|
2004-07-25 07:57:50 +00:00
|
|
|
}
|
2008-12-06 00:53:22 +00:00
|
|
|
|
2010-11-12 02:02:39 +00:00
|
|
|
; CHECK: @test2
|
|
|
|
; CHECK-NEXT: bitcast
|
|
|
|
; CHECK-NEXT: @free
|
|
|
|
; CHECK-NEXT: ret void
|
2008-12-06 00:53:22 +00:00
|
|
|
define void @test2({i32, i32}* %P) {
|
|
|
|
%Q = getelementptr {i32, i32} *%P, i32 0, i32 1
|
|
|
|
store i32 4, i32* %Q
|
|
|
|
free {i32,i32}* %P
|
|
|
|
ret void
|
|
|
|
}
|
2010-11-12 02:02:39 +00:00
|
|
|
|
2010-11-12 02:19:17 +00:00
|
|
|
; CHECK: @test4
|
|
|
|
; CHECK-NOT: store
|
|
|
|
; CHECK: ret void
|
|
|
|
define void @test4() {
|
|
|
|
%m = call i8* @malloc(i64 24)
|
|
|
|
store i8 0, i8* %m
|
|
|
|
%m1 = getelementptr i8* %m, i64 1
|
|
|
|
store i8 1, i8* %m1
|
|
|
|
call void @free(i8* %m)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @free(i8*)
|
|
|
|
declare i8* @malloc(i64)
|