llvm/llvm/test/Transforms/DeadStoreElimination/malloc-to-calloc-with-nonzero-default-as.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -S -passes=dse < %s | FileCheck %s

define ptr addrspace(4) @malloc_to_calloc(i64 %size) {
; CHECK-LABEL: define ptr addrspace(4) @malloc_to_calloc(
; CHECK-SAME: i64 [[SIZE:%.*]]) {
; CHECK-NEXT:    [[CALLOC:%.*]] = call ptr addrspace(4) @calloc(i64 1, i64 [[SIZE]])
; CHECK-NEXT:    ret ptr addrspace(4) [[CALLOC]]
;
  %ret = call ptr addrspace(4) @malloc(i64 %size)
  call void @llvm.memset.p4.i64(ptr addrspace(4) %ret, i8 0, i64 %size, i1 false)
  ret ptr addrspace(4) %ret
}

declare void @llvm.memset.p4.i64(ptr addrspace(4) nocapture writeonly, i8, i64, i1 immarg)

declare noalias ptr addrspace(4) @malloc(i64) willreturn allockind("alloc,uninitialized") "alloc-family"="malloc"