diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:08:53 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:08:53 +0000 |
commit | ec35d57225c9cd7f69ab1b25982b90bfc0f878e7 (patch) | |
tree | 76614e3dc76ef5ed5c36c69e9e65f8e84c1c0404 /gcc | |
parent | c94843d2422bdf77e2f86fad0329838f36773b43 (diff) | |
download | gcc-ec35d57225c9cd7f69ab1b25982b90bfc0f878e7.zip gcc-ec35d57225c9cd7f69ab1b25982b90bfc0f878e7.tar.gz gcc-ec35d57225c9cd7f69ab1b25982b90bfc0f878e7.tar.bz2 |
[5/77] Small tweak to array_value_type
Store the type mode in a variable so that a later,
more mechanical patch can change its type.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* tree-switch-conversion.c (array_value_type): Only read TYPE_MODE
once. Use get_narrowest_mode instead of GET_CLASS_NARROWEST_MODE.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251456
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/tree-switch-conversion.c | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7742722..8765c3c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,11 @@ 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> + Alan Hayward <alan.hayward@arm.com> + David Sherwood <david.sherwood@arm.com> + + * tree-switch-conversion.c (array_value_type): Only read TYPE_MODE + once. Use get_narrowest_mode instead of GET_CLASS_NARROWEST_MODE. + +2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index 5a827a6..85d6816 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -1037,7 +1037,6 @@ array_value_type (gswitch *swtch, tree type, int num, { unsigned int i, len = vec_safe_length (info->constructors[num]); constructor_elt *elt; - machine_mode mode; int sign = 0; tree smaller_type; @@ -1051,8 +1050,9 @@ array_value_type (gswitch *swtch, tree type, int num, if (!INTEGRAL_TYPE_P (type)) return type; - mode = GET_CLASS_NARROWEST_MODE (GET_MODE_CLASS (TYPE_MODE (type))); - if (GET_MODE_SIZE (TYPE_MODE (type)) <= GET_MODE_SIZE (mode)) + machine_mode type_mode = TYPE_MODE (type); + machine_mode mode = get_narrowest_mode (type_mode); + if (GET_MODE_SIZE (type_mode) <= GET_MODE_SIZE (mode)) return type; if (len < (optimize_bb_for_size_p (gimple_bb (swtch)) ? 2 : 32)) @@ -1090,7 +1090,7 @@ array_value_type (gswitch *swtch, tree type, int num, mode = GET_MODE_WIDER_MODE (mode); if (mode == VOIDmode - || GET_MODE_SIZE (mode) >= GET_MODE_SIZE (TYPE_MODE (type))) + || GET_MODE_SIZE (mode) >= GET_MODE_SIZE (type_mode)) return type; } } |