* [committed] Fix example in header comment in tree-call-cdce.c
@ 2015-04-28 9:10 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2015-04-28 9:10 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 529 bytes --]
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
[-- Attachment #2: 0001-Fix-example-in-header-comment-in-tree-call-cdce.c.patch --]
[-- Type: text/x-patch, Size: 743 bytes --]
Fix example in header comment in tree-call-cdce.c
2015-04-28 Tom de Vries <tom@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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-04-28 8:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-28 9:10 [committed] Fix example in header comment in tree-call-cdce.c Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).