aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2024-06-18 12:22:30 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2024-06-18 12:22:30 +0100
commit01044471ea39f9be4803c583ef2a946abc657f99 (patch)
treeb2c5bb1b42b78b8ee974a106929e8a8adbc4a86a /gcc
parentc9b96a68860bfdee49d40b4a844af7c5ef69cd12 (diff)
downloadgcc-01044471ea39f9be4803c583ef2a946abc657f99.zip
gcc-01044471ea39f9be4803c583ef2a946abc657f99.tar.gz
gcc-01044471ea39f9be4803c583ef2a946abc657f99.tar.bz2
Make force_subreg emit nothing on failure
While adding more uses of force_subreg, I realised that it should be more careful to emit no instructions on failure. This kind of failure should be very rare, so I don't think it's a case worth optimising for. gcc/ * explow.cc (force_subreg): Emit no instructions on failure.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/explow.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/explow.cc b/gcc/explow.cc
index f684339..bd93c87 100644
--- a/gcc/explow.cc
+++ b/gcc/explow.cc
@@ -756,8 +756,12 @@ force_subreg (machine_mode outermode, rtx op,
if (x)
return x;
+ auto *start = get_last_insn ();
op = copy_to_mode_reg (innermode, op);
- return simplify_gen_subreg (outermode, op, innermode, byte);
+ rtx res = simplify_gen_subreg (outermode, op, innermode, byte);
+ if (!res)
+ delete_insns_since (start);
+ return res;
}
/* If X is a memory ref, copy its contents to a new temp reg and return