[Remarks] Provide more information about auto-init calls
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Thu, 25 Feb 2021 17:49:53 +0000 (09:49 -0800)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Thu, 25 Feb 2021 23:14:09 +0000 (15:14 -0800)
commitfee9abe69c0eb5529984f5573cf6a5d881f80649
treea7e6a4ed8802f60f2857a244be75a2954fe7e941
parent4753a69a316b7705fc1b1442ad88afac059d542f
[Remarks] Provide more information about auto-init calls

This now analyzes calls to both intrinsics and functions.

For intrinsics, grab the ones we know and care about (mem* family) and
analyze the arguments.

For calls, use TLI to get more information about the libcalls, then
analyze the arguments if known.

```
auto-init.c:4:7: remark: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 4096 bytes. [-Rpass-missed=annotation-remarks]
  int var[1024];
      ^
```

Differential Revision: https://reviews.llvm.org/D97489
llvm/include/llvm/Transforms/Utils/AutoInitRemark.h
llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
llvm/lib/Transforms/Utils/AutoInitRemark.cpp
llvm/test/Other/new-pm-O0-defaults.ll
llvm/test/Transforms/Util/trivial-auto-var-init-call.ll
llvm/test/Transforms/Util/trivial-auto-var-init-unknown.ll