llvm/llvm/test/Transforms/InstCombine/pr77064.ll

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

define void @main(ptr %ptr) {
; CHECK-LABEL: define void @main(
; CHECK-SAME: ptr [[PTR:%.*]]) {
; CHECK-NEXT:    [[OPENDIR:%.*]] = call fastcc ptr @opendir(ptr [[PTR]])
; CHECK-NEXT:    call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(596) [[OPENDIR]], i8 0, i64 596, i1 false)
; CHECK-NEXT:    ret void
;
  %opendir = call fastcc ptr @opendir(ptr %ptr)
  %memset = call ptr @__memset_chk(ptr %opendir, i32 0, i64 596, i64 -1)
  ret void
}

declare ptr @__memset_chk(ptr, i32, i64, i64)

declare fastcc ptr @opendir(ptr)