aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/memset-1.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/InstCombine/memset-1.ll')
-rw-r--r--test/Transforms/InstCombine/memset-1.ll9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/memset-1.ll b/test/Transforms/InstCombine/memset-1.ll
index 7310e5f4faf8..86f3afdef8dc 100644
--- a/test/Transforms/InstCombine/memset-1.ll
+++ b/test/Transforms/InstCombine/memset-1.ll
@@ -26,6 +26,15 @@ define i8* @pr25892_lite(i32 %size) #0 {
; CHECK-NEXT: ret i8* %calloc
}
+; This should not create a calloc and not crash the compiler.
+; CHECK-LABEL: @notmalloc_memset
+; CHECK-NOT: @calloc
+define i8* @notmalloc_memset(i32 %size, i8*(i32)* %notmalloc) {
+ %call1 = call i8* %notmalloc(i32 %size) #1
+ %call2 = call i8* @memset(i8* %call1, i32 0, i32 %size) #1
+ ret i8* %call2
+}
+
; FIXME: memset(malloc(x), 0, x) -> calloc(1, x)
; This doesn't fire currently because the malloc has more than one use.