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

Shubham Sandeep Rastogi via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 11:20:10 PDT 2024


rastogishubham wrote:

I ran the dropped variable statistics on SemaExpr.cpp in -O2 using the invocation:

```
 bin/clang++ -g -O2 -mllvm -dropped-variable-stats -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/shubham/Development/llvm-project/build_ninja/tools/clang/lib/Sema -I/Users/shubham/Development/llvm-project/clang/lib/Sema -I/Users/shubham/Development/llvm-project/clang/include -I/Users/shubham/Development/llvm-project/build_ninja/tools/clang/include -I/Users/shubham/Development/llvm-project/build_ninja/include -I/Users/shubham/Development/llvm-project/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -fno-common -Woverloaded-virtual -Wno-nested-anon-types -DNDEBUG -std=c++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExpr.cpp.o -MF tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExpr.cpp.o.d -o tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExpr.cpp.o -c /Users/shubham/Development/llvm-project/clang/lib/Sema/SemaExpr.cpp
 ```
 
And I see:

'SCCPPass': 1,
'InstCombinePass': 21
'JumpThreadingPass': 105
'SimplifyCFGPass': 140

Seems like JumpThreading and SimplifyCFG passes drop the most debug information

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


More information about the llvm-commits mailing list