The problem while using opt passes

When I use instcount pass to count the number of instructions in an IR file test1.ll,it just print the content of test1.ll on the terminal instead of print the statistic information as I expect.
The command I use as below:
ubuntu@VM-20-15-ubuntu:~/MyLLVM/learn$ opt -S -passes=instcount -stats test1.ll
My opt version as below:
ubuntu@VM-20-15-ubuntu:~/MyLLVM/learn$ opt --version
Ubuntu LLVM version 18.1.3
Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: znver2

The content of test1.ll is as below

; ModuleID = 'test1.c'
source_filename = "test1.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@dead_global = dso_local global i32 10, align 4
@.str = private unnamed_addr constant [7 x i8] c"k+r=%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"y=%d\00", align 1

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @func1() #0 {
  ret i32 3
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @func2(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  store i32 %0, ptr %2, align 4
  %3 = load i32, ptr %2, align 4
  %4 = call i32 @func1()
  %5 = add nsw i32 %3, %4
  ret i32 %5
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 0, ptr %2, align 4
  br label %9

9:                                                ; preds = %25, %0
  %10 = load i32, ptr %2, align 4
  %11 = icmp slt i32 %10, 5
  br i1 %11, label %12, label %28

12:                                               ; preds = %9
  store i32 1, ptr %3, align 4
  br label %13

13:                                               ; preds = %21, %12
  %14 = load i32, ptr %3, align 4
  %15 = icmp slt i32 %14, 4
  br i1 %15, label %16, label %24

16:                                               ; preds = %13
  %17 = load i32, ptr %3, align 4
  %18 = load i32, ptr %2, align 4
  %19 = add nsw i32 %17, %18
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %19)
  br label %21

21:                                               ; preds = %16
  %22 = load i32, ptr %3, align 4
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %3, align 4
  br label %13, !llvm.loop !6

24:                                               ; preds = %13
  br label %25

25:                                               ; preds = %24
  %26 = load i32, ptr %2, align 4
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %2, align 4
  br label %9, !llvm.loop !8

28:                                               ; preds = %9
  store i32 1, ptr %4, align 4
  %29 = load i32, ptr %4, align 4
  %30 = load i32, ptr %4, align 4
  %31 = call i32 @func2(i32 noundef %30)
  %32 = add nsw i32 %29, %31
  store i32 %32, ptr %5, align 4
  %33 = load i32, ptr %5, align 4
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %33)
  store i32 0, ptr %4, align 4
  store i32 3, ptr %6, align 4
  %35 = load i32, ptr %6, align 4
  %36 = icmp sgt i32 %35, 5
  br i1 %36, label %37, label %43

37:                                               ; preds = %28
  store i32 1, ptr %7, align 4
  %38 = load i32, ptr %6, align 4
  %39 = load i32, ptr %6, align 4
  %40 = mul nsw i32 %38, %39
  %41 = load i32, ptr %7, align 4
  %42 = add nsw i32 %41, %40
  store i32 %42, ptr %7, align 4
  br label %67

43:                                               ; preds = %28
  store i32 2, ptr %8, align 4
  br label %44

44:                                               ; preds = %63, %43
  %45 = load i32, ptr %8, align 4
  %46 = icmp slt i32 %45, 10
  br i1 %46, label %47, label %66

47:                                               ; preds = %44
  %48 = load i32, ptr %8, align 4
  %49 = sub nsw i32 %48, 1
  %50 = load i32, ptr %8, align 4
  %51 = sdiv i32 %50, 2
  %52 = icmp sgt i32 %49, %51
  br i1 %52, label %53, label %56

53:                                               ; preds = %47
  %54 = load i32, ptr %8, align 4
  %55 = sub nsw i32 %54, 1
  br label %59

56:                                               ; preds = %47
  %57 = load i32, ptr %8, align 4
  %58 = sdiv i32 %57, 2
  br label %59

59:                                               ; preds = %56, %53
  %60 = phi i32 [ %55, %53 ], [ %58, %56 ]
  %61 = load i32, ptr %4, align 4
  %62 = add nsw i32 %61, %60
  store i32 %62, ptr %4, align 4
  br label %63

63:                                               ; preds = %59
  %64 = load i32, ptr %8, align 4
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %8, align 4
  br label %44, !llvm.loop !9

66:                                               ; preds = %44
  br label %67

67:                                               ; preds = %66, %37
  %68 = load i32, ptr %4, align 4
  %69 = mul nsw i32 2, %68
  store i32 %69, ptr %5, align 4
  ret i32 0
}

declare i32 @printf(ptr noundef, ...) #1

attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.ident = !{!5}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{i32 7, !"frame-pointer", i32 2}
!5 = !{!"Ubuntu clang version 18.1.3 (1ubuntu1)"}
!6 = distinct !{!6, !7}
!7 = !{!"llvm.loop.mustprogress"}
!8 = distinct !{!8, !7}
!9 = distinct !{!9, !7}

I think -stats requires a Debug build or a build with -DLLVM_ENABLE_ASSERTIONS=ON.

For completeness, there is also the LLVM_FORCE_ENABLE_STATS option

Thank you both of you,I have rebuild another Debug mode llvm project and solved the problem.