add a simple case where instcombine can detect and remove a dead alloca
[oota-llvm.git] / test / Transforms / InstCombine / alloca.ll
1 ; Zero byte allocas should be deleted.
2
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep alloca
4
5 declare void %use(...)
6 void %test() {
7         %X = alloca [0 x int]
8         call void(...)* %use([0 x int] *%X)
9         %Y = alloca int, uint 0
10         call void(...)* %use(int* %Y)
11         %Z = alloca {}
12         call void(...)* %use({}* %Z)
13         ret void
14 }
15
16 void %test2() {
17         %A = alloca int    ;; dead.
18         store int 123, int* %A
19         ret void
20 }
21
22 void %test3() {
23         %A = alloca {int}    ;; dead.
24         %B = getelementptr {int}* %A, int 0, uint 0
25         store int 123, int* %B
26         ret void
27 }