From 28af9b9ca8e208d950904dd6b865a5dc57ab87d5 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Tue, 1 Dec 2015 14:53:53 +0000 Subject: [PATCH] PR68474: Fix tree-call-cdce.c:use_internal_fn 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231115 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr68474.c | 7 +++++++ gcc/tree-call-cdce.c | 3 ++- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr68474.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 10d90fe82c6..5b631cf8fd8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-12-01 Richard Sandiford + + PR tree-optimization/68474 + * tree-call-cdce.c (use_internal_fn): Protect call to + gen_shrink_wrap_conditions. + 2015-12-01 Christian Bruel PR target/68617 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8463980e90e..78d31efefaa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-01 Richard Sandiford + + PR tree-optimization/68474 + * gcc.dg/pr68474.c: New test. + 2015-12-01 Christian Bruel PR target/68617 diff --git a/gcc/testsuite/gcc.dg/pr68474.c b/gcc/testsuite/gcc.dg/pr68474.c new file mode 100644 index 00000000000..8ad7def4b74 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr68474.c @@ -0,0 +1,7 @@ +/* { dg-options "-O -funsafe-math-optimizations" } */ + +long double +foo (long double d1, long double d2) +{ + return d1 || __builtin_significandl (d2); +} diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c index 75ef180933b..4123130ab2a 100644 --- a/gcc/tree-call-cdce.c +++ b/gcc/tree-call-cdce.c @@ -959,7 +959,8 @@ use_internal_fn (gcall *call) { unsigned nconds = 0; auto_vec 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; -- 2.11.4.GIT