aboutsummaryrefslogtreecommitdiff
path: root/gcc/reg-stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/reg-stack.c')
-rw-r--r--gcc/reg-stack.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index ab400c5..a7a5fb7 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -309,6 +309,13 @@ straighten_stack (insn, regstack)
struct stack_def temp_stack;
int top;
+ /* If there is only a single register on the stack, then the stack is
+ already in increasing order and no reorganization is needed.
+
+ Similarly if the stack is empty. */
+ if (regstack->top <= 0)
+ return;
+
temp_stack.reg_set = regstack->reg_set;
for (top = temp_stack.top = regstack->top; top >= 0; top--)