Hi,

Consider log.c:
...
#include <math.h>

void
f (double d)
{
  log (d);
}
...


When compiling with -O2, at optimized dump the code looks like this, thanks to pass_call_cdce:
...
f (double d)
{
  <bb 2>:
  if (d_2(D) <= 0.0)
    goto <bb 3>;
  else
    goto <bb 4>;

  <bb 3>:
  log (d_2(D)); [tail call]

  <bb 4>:
  return;

}
...

The error condition for log is d <= 0.0 (zero is pole error, negative is domain error).

Updated the example in the header comment in tree-calll-cdce.c accordingly.

Thanks,
- Tom
Fix example in header comment in tree-call-cdce.c

2015-04-28  Tom de Vries  <t...@codesourcery.com>

	* tree-call-cdce.c: Fix example in header comment.
---
 gcc/tree-call-cdce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index f0b3ce7..5a6a4cf 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -76,7 +76,7 @@ along with GCC; see the file COPYING3.  If not see
     An actual simple example is :
          log (x);   // Mostly dead call
      ==>
-         if (x < 0)
+         if (x <= 0)
              log (x);
      With this change, call to log (x) is effectively eliminated, as
      in majority of the cases, log won't be called with x out of
-- 
1.9.1

Reply via email to