aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine/cast-malloc.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/InstCombine/cast-malloc.ll')
-rw-r--r--test/Transforms/InstCombine/cast-malloc.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/cast-malloc.ll b/test/Transforms/InstCombine/cast-malloc.ll
new file mode 100644
index 0000000..25eb436
--- /dev/null
+++ b/test/Transforms/InstCombine/cast-malloc.ll
@@ -0,0 +1,8 @@
+; test that casted mallocs get converted to malloc of the right type
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast
+
+int* %test(uint %size) {
+ %X = malloc long, uint %size
+ %ret = bitcast long* %X to int*
+ ret int* %ret
+}