summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/realloc.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/InstCombine/realloc.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/realloc.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/realloc.ll b/llvm/test/Transforms/InstCombine/realloc.ll
new file mode 100644
index 00000000000..22f37f1d2fa
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/realloc.ll
@@ -0,0 +1,24 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+declare i8* @realloc(i8*, i64) #1
+declare noalias i8* @malloc(i64) #1
+
+
+define i8* @realloc_null_ptr() #0 {
+; CHECK-LABEL: @realloc_null_ptr(
+; CHECK-NEXT: [[MALLOC:%.*]] = call i8* @malloc(i64 100)
+; CHECK-NEXT: ret i8* [[MALLOC]]
+;
+ %call = call i8* @realloc(i8* null, i64 100) #2
+ ret i8* %call
+}
+
+define i8* @realloc_unknown_ptr(i8* %ptr) #0 {
+; CHECK-LABEL: @realloc_unknown_ptr(
+; CHECK-NEXT: [[CALL:%.*]] = call i8* @realloc(i8* [[PTR:%.*]], i64 100)
+; CHECK-NEXT: ret i8* [[CALL]]
+;
+ %call = call i8* @realloc(i8* %ptr, i64 100) #2
+ ret i8* %call
+}
OpenPOWER on IntegriCloud