[llvm-commits] patch: CXAGuardElimination pass.
Nick Lewycky
nicholas at mxc.ca
Sun May 24 21:34:06 PDT 2009
This pass eliminates dead calls to __cxa_guard_acquire and
__cxa_guard_release. Those two functions are defined by the Itanium ABI
as part of the thread-safe one-time construction ABI for static
variables in functions.
For example, this program:
struct X {
X(int) {}
};
void foo() {
static X x(10);
}
would have calls to cxa_guard_* in foo, and this pass detects that there
is no real work being done between the guards and therefore it is safe
to eliminate them.
However, it doesn't simplify it down all the way. See llvm.org/PR4261
for an example of what happens after this optimization is applied on the
above program. We may decide that PR4261 is too hard to fix in general
and just add some extra logic to this pass, but I'd rather have this
committed for a start.
Please review!
Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cxaguardelim.patch
Type: text/x-diff
Size: 11566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090524/4b68ff78/attachment.patch>
More information about the llvm-commits
mailing list