summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-04 15:42:19 +0000
committerwschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-04 15:42:19 +0000
commit8ff377a61edb855f1cd9717dac2b92cbaab0f7c4 (patch)
tree9d67f382c1c643eabb3c6bf93bf62b0ab5d236c6
parentf567b44f6266b33f289688e84f361bb316636efa (diff)
downloadgcc-8ff377a61edb855f1cd9717dac2b92cbaab0f7c4.tar.gz
[gcc]
2016-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Jakub Jelinek <jakub@redhat.com> PR middle-end/70457 * tree-inline.c (estimate_num_insn): Use gimple_call_builtin_p to ensure a call statement is compatible with a built-in's prototype. * tree-ssa-math-opts.c (pass_optimize_windening_mul::execute): Likewise. [gcc/testsuite] 2016-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Jakub Jelinek <jakub@redhat.com> PR middle-end/70457 * gcc.dg/torture/pr70457.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234716 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr70457.c29
-rw-r--r--gcc/tree-inline.c2
-rw-r--r--gcc/tree-ssa-math-opts.c2
5 files changed, 47 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 83f3454a0ee..b478b0f2832 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2016-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/70457
+ * tree-inline.c (estimate_num_insn): Use gimple_call_builtin_p
+ to ensure a call statement is compatible with a built-in's
+ prototype.
+ * tree-ssa-math-opts.c (pass_optimize_windening_mul::execute):
+ Likewise.
+
2016-04-04 Richard Biener <rguenther@suse.de>
PR rtl-optimization/70484
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2de8ea55fd0..c9b020524d6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2016-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/70457
+ * gcc.dg/torture/pr70457.c: New.
+
2016-04-04 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/67538
diff --git a/gcc/testsuite/gcc.dg/torture/pr70457.c b/gcc/testsuite/gcc.dg/torture/pr70457.c
new file mode 100644
index 00000000000..74daed4d36f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr70457.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+
+/* This formerly ICEd when trying to expand pow as a built-in with
+ the wrong number of arguments. */
+
+extern double pow (double, double) __attribute__ ((__nothrow__ , __leaf__));
+
+typedef struct {
+ long long data;
+ int tag;
+} Object;
+
+extern Object Make_Flonum (double);
+extern Object P_Pow (Object, Object);
+
+Object General_Function (Object x, Object y, double (*fun)()) {
+ double d, ret;
+
+ d = 1.0;
+
+ if (y.tag >> 1)
+ ret = (*fun) (d);
+ else
+ ret = (*fun) (d, 0.0);
+
+ return Make_Flonum (ret);
+}
+
+Object P_Pow (Object x, Object y) { return General_Function (x, y, pow); }
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 5206d202bab..a4e044c611b 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4065,7 +4065,7 @@ estimate_num_insns (gimple *stmt, eni_weights *weights)
return 0;
else if (is_inexpensive_builtin (decl))
return weights->target_builtin_call_cost;
- else if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
+ else if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
{
/* We canonicalize x * x to pow (x, 2.0) with -ffast-math, so
specialize the cheap expansion we do here.
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 4626022b8b8..735b7c67c31 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -3827,7 +3827,7 @@ pass_optimize_widening_mul::execute (function *fun)
{
tree fndecl = gimple_call_fndecl (stmt);
if (fndecl
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ && gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
{
switch (DECL_FUNCTION_CODE (fndecl))
{