[llvm] Add a pass to collect dropped variable statistics (PR #102233)

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 09:38:28 PDT 2024


felipepiovezan wrote:

I echo Adrian's comments about tests, though I am unsure how to do it.
You can probably construct a simple pipeline through `opt`, containing for example two passes, with some hand-crafted IR that will be certain to drop variables.
For example, if you have a function like this:

```
define @foo(i32 %arg) {
   %storage = alloca i32
   store i32, i32 %arg, ptr %storage
   dbg_declare(%storage, !somevar)
}
```

This will easily be optimized away / dropped

https://github.com/llvm/llvm-project/pull/102233


More information about the llvm-commits mailing list