aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-09-01 18:49:26 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-09-01 18:49:26 +0200
commitbff0050a4ee85782d8f43a2aa660aad5f466f67a (patch)
treed232ba9af0c77e1af1f17a69140098faa777f700 /gcc
parentde7c2c6a2479de0002f6a07002b6bca4a3a73015 (diff)
downloadgcc-bff0050a4ee85782d8f43a2aa660aad5f466f67a.zip
gcc-bff0050a4ee85782d8f43a2aa660aad5f466f67a.tar.gz
gcc-bff0050a4ee85782d8f43a2aa660aad5f466f67a.tar.bz2
re PR target/81766 (ICE in maybe_add_or_update_dep_1, at sched-deps.c:924 caused by r250815)
PR target/81766 * config/i386/i386.c (ix86_init_large_pic_reg): Return label instead of void. (ix86_init_pic_reg): Remember label from ix86_init_large_pic_reg, if non-NULL and preceded by NOTE_INSN_BASIC_BLOCK, swap the note and label. * gcc.target/i386/pr81766.c: New test. From-SVN: r251606
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/i386.c22
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr81766.c9
4 files changed, 41 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f9d9eb7..4cc3ac6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2017-09-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/81766
+ * config/i386/i386.c (ix86_init_large_pic_reg): Return label instead of void.
+ (ix86_init_pic_reg): Remember label from ix86_init_large_pic_reg, if non-NULL
+ and preceded by NOTE_INSN_BASIC_BLOCK, swap the note and label.
+
2017-09-01 Joerg Sonnenberger <joerg@bec.de>
Jeff Law <law@redhat.com>
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 4eaf6e0..0fe2958 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -8885,7 +8885,7 @@ ix86_use_pseudo_pic_reg (void)
/* Initialize large model PIC register. */
-static void
+static rtx_code_label *
ix86_init_large_pic_reg (unsigned int tmp_regno)
{
rtx_code_label *label;
@@ -8902,6 +8902,7 @@ ix86_init_large_pic_reg (unsigned int tmp_regno)
emit_insn (gen_set_got_offset_rex64 (tmp_reg, label));
emit_insn (ix86_gen_add3 (pic_offset_table_rtx,
pic_offset_table_rtx, tmp_reg));
+ return label;
}
/* Create and initialize PIC register if required. */
@@ -8910,6 +8911,7 @@ ix86_init_pic_reg (void)
{
edge entry_edge;
rtx_insn *seq;
+ rtx_code_label *label = NULL;
if (!ix86_use_pseudo_pic_reg ())
return;
@@ -8919,7 +8921,7 @@ ix86_init_pic_reg (void)
if (TARGET_64BIT)
{
if (ix86_cmodel == CM_LARGE_PIC)
- ix86_init_large_pic_reg (R11_REG);
+ label = ix86_init_large_pic_reg (R11_REG);
else
emit_insn (gen_set_got_rex64 (pic_offset_table_rtx));
}
@@ -8943,6 +8945,22 @@ ix86_init_pic_reg (void)
entry_edge = single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun));
insert_insn_on_edge (seq, entry_edge);
commit_one_edge_insertion (entry_edge);
+
+ if (label)
+ {
+ basic_block bb = BLOCK_FOR_INSN (label);
+ rtx_insn *bb_note = PREV_INSN (label);
+ /* If the note preceding the label starts a basic block, and the
+ label is a member of the same basic block, interchange the two. */
+ if (bb_note != NULL_RTX
+ && NOTE_INSN_BASIC_BLOCK_P (bb_note)
+ && bb != NULL
+ && bb == BLOCK_FOR_INSN (bb_note))
+ {
+ reorder_insns_nobb (bb_note, bb_note, label);
+ BB_HEAD (bb) = label;
+ }
+ }
}
/* Initialize a variable CUM of type CUMULATIVE_ARGS
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 20f579e..4ead57e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/81766
+ * gcc.target/i386/pr81766.c: New test.
+
2017-09-01 Joseph Myers <joseph@codesourcery.com>
PR c/82071
diff --git a/gcc/testsuite/gcc.target/i386/pr81766.c b/gcc/testsuite/gcc.target/i386/pr81766.c
new file mode 100644
index 0000000..b5aa346
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr81766.c
@@ -0,0 +1,9 @@
+/* PR target/81766 */
+/* { dg-do compile { target { pie && lp64 } } } */
+/* { dg-options "-O2 -fpie -mcmodel=large" } */
+
+int
+main ()
+{
+ return 0;
+}