[cfe-commits] patch: add __attribute__((halting))

Nick Lewycky nlewycky at google.com
Mon Jul 5 23:55:00 PDT 2010


This patch adds support for an attribute used to indicate that the function
in question will not loop indefinitely. This is a counter-part to the LLVM
patch
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20100705/103672.htmlwhich
must be applied first.

The idea is that we can't currently delete the dead code:
  void foo(set<int> *s) { s->find(10); }
because the compiler is afraid that set<>::find may have the side-effect of
infinite looping. With a halting attribute manually applied in key places,
such as the declaration of find(), we can unstick dead code elimination and
ultimately reduce code size.

Please review!

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100705/4ee31f90/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-halting-1.patch
Type: text/x-patch
Size: 4713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100705/4ee31f90/attachment.bin>


More information about the cfe-commits mailing list