[OPENMP] Mark global tors/dtors as used.
authorAlexey Bataev <a.bataev@hotmail.com>
Wed, 9 May 2018 14:15:18 +0000 (14:15 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Wed, 9 May 2018 14:15:18 +0000 (14:15 +0000)
commite253f2f886a980c227a35508601bd0a6a5aba5c6
treece8effc7b97b4797d9fe1f011e220c0785c5c701
parentb27dd33c58db26f7115ddd39505479d0a50777dc
[OPENMP] Mark global tors/dtors as used.

If the global variables are marked as declare target and they need
ctors/dtors, these ctors/dtors are emitted and then invoked by the
offloading runtime library. They are not explicitly used in the emitted
code and thus can be optimized out. Patch marks these functions as used,
so the optimizer cannot remove these function during the optimization
phase.

llvm-svn: 331879
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/test/OpenMP/declare_target_codegen.cpp