在 2019/5/17 下午2:34, Jakub Jelinek 写道:
On Fri, May 17, 2019 at 02:24:22PM +0800, JunMa wrote:
2019-05-17  Jun Ma <ju...@linux.alibaba.com>
Two spaces before < rather than one.

     PR tree-optimization/90106
     * gcc.dg/cdce3.c: New test.
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cdce3.c
@@ -0,0 +1,12 @@
+/* { dg-do  compile } */
Just use one space instead of two.

+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -fdump-tree-optimized  
-lm" } */
For compile time test, no need to add "  -lm" (well, no need to add it even
for link/run tests).

+/* { dg-final { scan-tree-dump "cdce3.c:10: .* function call is shrink-wrapped into error 
conditions\." "cdce" } } */
Please use \[^\n\r]* instead of .*, you don't want newlines matched in
there.

+/* { dg-final { scan-tree-dump "sqrtf \\(\[^\n\r]*\\); \\\[tail call\\\]" 
"optimized" } } */
+
+#include <math.h>
Wouldn't it be better to just declare it yourself:
float sqrtf (float);
?
You really don't know what the target math.h includes.

+
+float foo ( float x )
+{
+  return sqrtf( x );
+}
+
--
1.8.3.1


Thanks for review so carefully. Update the patch based on your suggestion.

Regards
Jun

gcc/testsuite/ChangeLog

2019-05-17  Jun Ma  <ju...@linux.alibaba.com>

    PR tree-optimization/90106
    * gcc.dg/cdce3.c: New test.


        Jakub


---
 gcc/testsuite/gcc.dg/cdce3.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/cdce3.c

diff --git a/gcc/testsuite/gcc.dg/cdce3.c b/gcc/testsuite/gcc.dg/cdce3.c
new file mode 100644
index 0000000..8a74379
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cdce3.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details 
-fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump "cdce3.c:9: \[^\n\r]* function call is 
shrink-wrapped into error conditions\." "cdce" } } */
+/* { dg-final { scan-tree-dump "sqrtf \\(\[^\n\r]*\\); \\\[tail call\\\]" 
"optimized" } } */
+
+float sqrtf (float);
+float foo (float x)
+{
+  return sqrtf (x);
+}
+
-- 
1.8.3.1

Reply via email to