]> granicus.if.org Git - llvm/commit
[GlobalOpt] Simplify __cxa_atexit elimination
authorFangrui Song <maskray@google.com>
Sat, 9 Feb 2019 09:18:37 +0000 (09:18 +0000)
committerFangrui Song <maskray@google.com>
Sat, 9 Feb 2019 09:18:37 +0000 (09:18 +0000)
commita7866b1030537ff197099251d5ee6b46b35c13e2
tree769a718806f6de12a3e4a643e827a8163034cdc7
parentb9a8dc62465dd5292d9d93e91f3f9ac248a6891e
[GlobalOpt] Simplify __cxa_atexit elimination

cxxDtorIsEmpty checks callers recursively to determine if the
__cxa_atexit-registered function is empty, and eliminates the
__cxa_atexit call accordingly.

This recursive check is unnecessary as redundant instructions and
function calls can be removed by early-cse and inliner. In addition,
cxxDtorIsEmpty does not mark visited function and it may visit a
function exponential times (multiplication principle).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353603 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/GlobalOpt.cpp
test/Transforms/GlobalOpt/cxx-dtor.ll