param_sched_pressure_algorithm,
SCHED_PRESSURE_MODEL);
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ param_cycle_accurate_model,
+ 0);
+
/* Function to allocate machine-dependent function status. */
init_machine_status = &riscv_init_machine_status;
This is the current default.
With @option{--param=openacc-privatization=noisy}, do diagnose.
+@item cycle-accurate-model
+Specifies whether GCC should assume that the scheduling description is mostly
+a cycle-accurate model of the target processor, where the code is intended to
+run on, in the absence of cache misses. Nonzero means that the selected
+scheduling model is accurate and likely describes an in-order processor,
+and that scheduling will aggressively spill to try and fill any pipeline
+bubbles. This is the current default. Zero could mean scheduling descrption
+might not be available/accurate or perhaps not applicale at all such as for
+modern out-of-order processors.
+
@end table
The following choices of @var{name} are available on AArch64 targets:
int pressure, cl;
cl = ira_pressure_classes[pci];
- if (delta < 0 && point >= group->limits[pci].point)
+ if (delta < 0)
{
- pressure = MAX (group->limits[pci].orig_pressure,
- curr_reg_pressure[cl] + delta);
- return -model_spill_cost (cl, pressure, curr_reg_pressure[cl]);
+ if (point >= group->limits[pci].point)
+ {
+ pressure = MAX (group->limits[pci].orig_pressure,
+ curr_reg_pressure[cl] + delta);
+ return -model_spill_cost (cl, pressure, curr_reg_pressure[cl]);
+ }
+ /* if target prefers fewer spills, return the -ve delta indicating
+ pressure reduction. */
+ else if (!param_cycle_accurate_model)
+ return delta;
}
if (delta > 0)
}
if (print_p)
- fprintf (sched_dump, "\n");
+ fprintf (sched_dump, " ECC %d\n", cost);
return cost;
}
bool print_p;
/* Record the baseECC value for each instruction in the model schedule,
- except that negative costs are converted to zero ones now rather than
- later. Do not assign a cost to debug instructions, since they must
+ except that for targets which prefer wider schedules (more spills)
+ negative costs are converted to zero ones now rather than later.
+ Do not assign a cost to debug instructions, since they must
not change code-generation decisions. Experiments suggest we also
get better results by not assigning a cost to instructions from
a different block.
print_p = true;
}
cost = model_excess_cost (insns[i], print_p);
- if (cost <= 0)
+ if (param_cycle_accurate_model && cost <= 0)
{
priority = INSN_PRIORITY (insns[i]) - insn_delay (insns[i]) - cost;
priority_base = MAX (priority_base, priority);
if (print_p)
fprintf (sched_dump, MODEL_BAR);
+ /* Typically in-order cores have a good pipeline scheduling model and the
+ algorithm would try to use that to minimize bubbles, favoring spills.
+ MAX (baseECC, 0) below changes negative baseECC (pressure reduction)
+ to 0 (pressure neutral) thus tending to more spills.
+ Otherwise return. */
+ if (!param_cycle_accurate_model)
+ return;
+
/* Use MAX (baseECC, 0) and baseP to calculcate ECC for each
instruction. */
for (i = 0; i < count; i++)
Common Joined UInteger Var(param_asan_use_after_return) Init(1) IntegerRange(0, 1) Param Optimization
Enable asan detection of use-after-return bugs.
+-param=cycle-accurate-model
+Common Joined UInteger Var(param_cycle_accurate_model) Init(1) IntegerRange(0, 1) Param Optimization
+Whether the scheduling description is mostly a cycle-accurate model of the target processor and is likely to be spill aggressively to fill any pipeline bubbles.
+
-param=hwasan-instrument-stack=
Common Joined UInteger Var(param_hwasan_instrument_stack) Init(1) IntegerRange(0, 1) Param Optimization
Enable hwasan instrumentation of statically sized stack-allocated variables.
# Main loop.
gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
"" $DEFAULT_CFLAGS
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/sched1-spills/*.{\[cS\],cpp}]] \
+ "" $DEFAULT_CFLAGS
# Saturation alu
foreach opt {
--- /dev/null
+/* { dg-options "-O2 -march=rv64gc -mabi=lp64d -save-temps -fverbose-asm" } */
+/* { dg-skip-if "" { *-*-* } { "-O0" "O1" "-Og" "-Os" "-Oz" } } */
+
+/* Reduced from SPEC2017 Cactu ML_BSSN_Advect.cpp
+ by comparing -fschedule-insn and -fno-schedule-insns builds.
+ Shows up one extra spill (pair of spill markers "sfp") in verbose asm
+ output which the patch fixes. */
+
+void s();
+double b, c, d, e, f, g, h, k, l, m, n, o, p, q, t, u, v;
+int *j;
+double *r, *w;
+long x;
+void y() {
+ double *a((double *)s);
+ for (;;)
+ for (; j[1];)
+ for (int i = 1; i < j[0]; i++) {
+ k = l;
+ m = n;
+ o = p = q;
+ r[0] = t;
+ a[0] = u;
+ x = g;
+ e = f;
+ v = w[x];
+ b = c;
+ d = h;
+ }
+}
+
+/* { dg-final { scan-assembler-not "%sfp" } } */