blob: e863197a98e167030c91dd09917152a51cc42ce7 [file] [log] [blame]
Reid Spencer6c38f0b2006-11-27 01:05:10 +00001; test that casted mallocs get converted to malloc of the right type
Reid Spencerce380562007-01-26 08:25:06 +00002; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
3; RUN: not grep bitcast
Reid Spencer6c38f0b2006-11-27 01:05:10 +00004
Reid Spencerce380562007-01-26 08:25:06 +00005; The target datalayout is important for this test case. We have to tell
6; instcombine that the ABI alignment for a long is 4-bytes, not 8, otherwise
7; it won't do the transform.
8target datalayout = "e-l:32:64"
Reid Spencer6c38f0b2006-11-27 01:05:10 +00009int* %test(uint %size) {
10 %X = malloc long, uint %size
11 %ret = bitcast long* %X to int*
12 ret int* %ret
13}