PR68474: Fix tree-call-cdce.c:use_internal_fn
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 1 Dec 2015 14:53:53 +0000 (14:53 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 1 Dec 2015 14:53:53 +0000 (14:53 +0000)
We'd call gen_shrink_wrap_conditions for functions that it can't handle
but edom_only_function can.

Tested on x86_64-linux-gnu.

gcc/
PR tree-optimization/68474
* tree-call-cdce.c (use_internal_fn): Protect call to
gen_shrink_wrap_conditions.

gcc/testsuite/
PR tree-optimization/68474
* gcc.dg/pr68474.c: New test.

From-SVN: r231115

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr68474.c [new file with mode: 0644]
gcc/tree-call-cdce.c

index 10d90fe82c6f2cc39e3635aed11a497fb3c45fdd..5b631cf8fd8d6b3984225fe690d86fd417aa5a94 100644 (file)
@@ -1,3 +1,9 @@
+2015-12-01  Richard Sandiford  <richard.sandiford@arm.com>
+
+       PR tree-optimization/68474
+       * tree-call-cdce.c (use_internal_fn): Protect call to
+       gen_shrink_wrap_conditions.
+
 2015-12-01  Christian Bruel  <christian.bruel@st.com>
 
        PR target/68617
index 8463980e90e7b312ef6f45d80bce851a8b7cdbcb..78d31efefaaf63a20449350269299c40ef7a1331 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-01  Richard Sandiford  <richard.sandiford@arm.com>
+
+       PR tree-optimization/68474
+       * gcc.dg/pr68474.c: New test.
+
 2015-12-01  Christian Bruel  <christian.bruel@st.com>
 
        PR target/68617
diff --git a/gcc/testsuite/gcc.dg/pr68474.c b/gcc/testsuite/gcc.dg/pr68474.c
new file mode 100644 (file)
index 0000000..8ad7def
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-options "-O -funsafe-math-optimizations" } */
+
+long double
+foo (long double d1, long double d2)
+{
+  return d1 || __builtin_significandl (d2);
+}
index 75ef180933b49edb6965b5b3122874451ff2f368..4123130ab2a37a623cb777456bd51bfaa207bf09 100644 (file)
@@ -959,7 +959,8 @@ use_internal_fn (gcall *call)
 {
   unsigned nconds = 0;
   auto_vec<gimple *, 12> conds;
-  gen_shrink_wrap_conditions (call, conds, &nconds);
+  if (can_test_argument_range (call))
+    gen_shrink_wrap_conditions (call, conds, &nconds);
   if (nconds == 0 && !edom_only_function (call))
     return false;