aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-09-26 09:49:02 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-09-26 09:49:02 +0000
commitce438663a87db8ad44383fdf0d01364eb2ad877b (patch)
tree505b41ce5be5acc9f8e68844de274b816039d527 /gcc
parentbdbebf669ee8257685c2b6d1c501e899cd20bbea (diff)
downloadgcc-ce438663a87db8ad44383fdf0d01364eb2ad877b.zip
gcc-ce438663a87db8ad44383fdf0d01364eb2ad877b.tar.gz
gcc-ce438663a87db8ad44383fdf0d01364eb2ad877b.tar.bz2
ifcvt.c (noce_try_cmove_arith): Use may_trap_or_fault_p in lieu of may_trap_p to detect loads that may trap of...
* ifcvt.c (noce_try_cmove_arith): Use may_trap_or_fault_p in lieu of may_trap_p to detect loads that may trap of fault. From-SVN: r179188
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/ifcvt.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gnat.dg/opt21.adb11
-rw-r--r--gcc/testsuite/gnat.dg/opt21_pkg.adb17
-rw-r--r--gcc/testsuite/gnat.dg/opt21_pkg.ads15
6 files changed, 55 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 71ab33b..1e68d98 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * ifcvt.c (noce_try_cmove_arith): Use may_trap_or_fault_p in lieu of
+ may_trap_p to detect loads that may trap of fault.
+
2011-09-26 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr-protos.h (output_reload_inhi): Change prototype.
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 0fcacb6..0476a8a 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -1519,9 +1519,9 @@ noce_try_cmove_arith (struct noce_if_info *if_info)
}
/* ??? We could handle this if we knew that a load from A or B could
- not fault. This is also true if we've already loaded
+ not trap or fault. This is also true if we've already loaded
from the address along the path from ENTRY. */
- else if (may_trap_p (a) || may_trap_p (b))
+ else if (may_trap_or_fault_p (a) || may_trap_or_fault_p (b))
return FALSE;
/* if (test) x = a + b; else x = c - d;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e7e2594..2546ce1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2011-09-26 Eric Botcazou <ebotcazou@adacore.com>
+ * gnat.dg/opt21.adb: New test.
+ * gnat.dg/opt21_pkg.ad[sb]: New helper.
+
+2011-09-26 Eric Botcazou <ebotcazou@adacore.com>
+
* gnat.dg/opt20.ad[sb]: New test.
* gnat.dg/opt20_pkg.ads: New helper.
diff --git a/gcc/testsuite/gnat.dg/opt21.adb b/gcc/testsuite/gnat.dg/opt21.adb
new file mode 100644
index 0000000..c73fe9f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt21.adb
@@ -0,0 +1,11 @@
+-- { dg-do run }
+-- { dg-options "-O2" }
+
+with System;
+with Opt21_Pkg; use Opt21_Pkg;
+
+procedure Opt21 is
+ V : System.Address := Convert (null);
+begin
+ null;
+end;
diff --git a/gcc/testsuite/gnat.dg/opt21_pkg.adb b/gcc/testsuite/gnat.dg/opt21_pkg.adb
new file mode 100644
index 0000000..3c87321
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt21_pkg.adb
@@ -0,0 +1,17 @@
+package body Opt21_Pkg is
+
+ function Get_Object (Object : not null access R) return System.Address is
+ begin
+ return Object.Ptr;
+ end;
+
+ function Convert (W : Obj) return System.Address is
+ begin
+ if W = null then
+ return System.Null_Address;
+ else
+ return Get_Object (W);
+ end if;
+ end;
+
+end Opt21_Pkg;
diff --git a/gcc/testsuite/gnat.dg/opt21_pkg.ads b/gcc/testsuite/gnat.dg/opt21_pkg.ads
new file mode 100644
index 0000000..251bf84
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt21_pkg.ads
@@ -0,0 +1,15 @@
+with System;
+
+package Opt21_Pkg is
+
+ type R is record
+ Ptr : System.Address := System.Null_Address;
+ end record;
+
+ type Obj is access all R;
+
+ function Get_Object (Object : not null access R) return System.Address;
+
+ function Convert (W : Obj) return System.Address;
+
+end Opt21_Pkg;