gcc/add-check-for-pressure-in-sche1.patch

53 lines
1.5 KiB
Diff
Raw Normal View History

--- a/gcc/haifa-sched.c 2021-03-08 14:46:59.204000000 +0800
+++ b/gcc/haifa-sched.c 2021-03-09 13:32:40.656000000 +0800
@@ -2036,8 +2036,10 @@ model_start_update_pressure (struct mode
/* The instruction wasn't part of the model schedule; it was moved
from a different block. Update the pressure for the end of
the model schedule. */
- MODEL_REF_PRESSURE (group, point, pci) += delta;
- MODEL_MAX_PRESSURE (group, point, pci) += delta;
+ if (MODEL_REF_PRESSURE (group, point, pci) != -1 || delta > 0)
+ MODEL_REF_PRESSURE (group, point, pci) += delta;
+ if (MODEL_MAX_PRESSURE (group, point, pci) != -1 || delta > 0)
+ MODEL_MAX_PRESSURE (group, point, pci) += delta;
}
else
{
diff -uprN a/gcc/testsuite/gcc.dg/sche1-pressure-check.c b/gcc/testsuite/gcc.dg/sche1-pressure-check.c
--- a/gcc/testsuite/gcc.dg/sche1-pressure-check.c 1970-01-01 08:00:00.000000000 +0800
+++ b/gcc/testsuite/gcc.dg/sche1-pressure-check.c 2021-03-09 13:40:34.036000000 +0800
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+int a, g, h;
+char b, c;
+short d;
+static int e;
+int *volatile f;
+void i() {
+ int j = 0;
+ int *k = &a;
+ for (; c; c--) {
+ g && (d = 0);
+ j ^= 10;
+ {
+ int l[2];
+ l;
+ h = l[1];
+ }
+ e = 1;
+ for (; e <= 7; e++) {
+ *k = 6;
+ *f = b = 0;
+ for (; b <= 7; b++) {
+ int m = 5;
+ if (g)
+ *k &= m ^= j;
+ }
+ }
+ }
+}
+int main() {}
+