aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2018-11-07 06:25:30 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2018-11-07 06:25:30 +0000
commit59193b1bdf0b0d707d3a21b006d3cb9d3fec7013 (patch)
treebaa2a3a8ccecccdcb8110541d7a9f419fc409709 /gcc
parent513c11068ff08576975039c37d6d6f7192f8f190 (diff)
downloadgcc-59193b1bdf0b0d707d3a21b006d3cb9d3fec7013.zip
gcc-59193b1bdf0b0d707d3a21b006d3cb9d3fec7013.tar.gz
gcc-59193b1bdf0b0d707d3a21b006d3cb9d3fec7013.tar.bz2
[PR87874] avoid const-wide-int subreg in LRA
Just like CONST_INT, CONST_WIDE_INT is VOIDmode, so LRA might be tempted to build a SUBREG to "convert" it to the wanted mode. That's no use. Test for CONST_SCALAR_INT_P instead of CONST_INT_P so that we skip the subreg creation for both. for gcc/ChangeLog PR rtl-optimization/87874 * lra.c (lra_substitute_pseudo): Do not create a subreg for const wide ints. for gcc/testsuite/ChangeLog PR rtl-optimization/87874 * gcc.dg/pr87874.c: New. From-SVN: r265860
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/lra.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr87874.c35
4 files changed, 47 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0c33c67..d1fde63 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2018-11-07 Alexandre Oliva <aoliva@redhat.com>
+
+ PR rtl-optimization/87874
+ * lra.c (lra_substitute_pseudo): Do not create a subreg for
+ const wide ints.
+
2018-11-06 Aaron Sawdey <acsawdey@linux.ibm.com>
* config/rs6000/rs6000.md (bswap<mode>2): Force address into register
diff --git a/gcc/lra.c b/gcc/lra.c
index aa768fb..5d58d90 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -1961,7 +1961,7 @@ lra_substitute_pseudo (rtx *loc, int old_regno, rtx new_reg, bool subreg_p,
machine_mode inner_mode = GET_MODE (new_reg);
if (mode != inner_mode
- && ! (CONST_INT_P (new_reg) && SCALAR_INT_MODE_P (mode)))
+ && ! (CONST_SCALAR_INT_P (new_reg) && SCALAR_INT_MODE_P (mode)))
{
poly_uint64 offset = 0;
if (partial_subreg_p (mode, inner_mode)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4c1610d..66a09d6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-07 Alexandre Oliva <aoliva@redhat.com>
+
+ PR rtl-optimization/87874
+ * gcc.dg/pr87874.c: New.
+
2018-11-06 Ilya Leoshkevich <iii@linux.ibm.com>
* gcc.target/s390/load-and-test-fp-1.c: Accept cdb.
diff --git a/gcc/testsuite/gcc.dg/pr87874.c b/gcc/testsuite/gcc.dg/pr87874.c
new file mode 100644
index 0000000..3ab5dcf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr87874.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-g -O1 -fgcse -fno-dce -fno-tree-ccp -fno-tree-coalesce-vars -fno-tree-copy-prop -fno-tree-dce -fno-tree-dominator-opts -fno-tree-fre -fno-tree-loop-optimize -fno-tree-sink" } */
+
+int *vk;
+int m2;
+#if __SIZEOF_INT128__
+__int128 nb;
+
+void
+em (int u5, int fo, int s7)
+{
+ for (;;)
+ {
+ long int es;
+
+ es = !!u5 ? (!!fo && !!m2) : fo;
+ if (es == 0)
+ if (nb == *vk)
+ {
+ const unsigned long int uint64_max = 18446744073709551615ul;
+ __int128 ks = uint64_max / 2 + 1;
+
+ while (s7 < 1)
+ while (nb < 2)
+ {
+ for (ks = 0; ks < 3; ++ks)
+ {
+ }
+
+ ++nb;
+ }
+ }
+ }
+}
+#endif