mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-21 16:31:16 +00:00
720a2ed6d9
one store dead. This is especially noticeable in SingleSource/Benchmarks/Shootout/objinst. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118875 91177308-0d34-0410-b5e6-96231b3b80d8
41 lines
833 B
LLVM
41 lines
833 B
LLVM
; RUN: opt < %s -basicaa -dse -S | FileCheck %s
|
|
|
|
target datalayout = "e-p:64:64:64"
|
|
|
|
; CHECK: @test
|
|
; CHECK-NEXT: bitcast
|
|
; CHECK-NEXT: @free
|
|
; CHECK-NEXT: ret void
|
|
define void @test(i32* %Q, i32* %P) {
|
|
%DEAD = load i32* %Q ; <i32> [#uses=1]
|
|
store i32 %DEAD, i32* %P
|
|
free i32* %P
|
|
ret void
|
|
}
|
|
|
|
; CHECK: @test2
|
|
; CHECK-NEXT: bitcast
|
|
; CHECK-NEXT: @free
|
|
; CHECK-NEXT: ret void
|
|
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
|
|
}
|
|
|
|
; 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)
|