diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-11-04 21:14:22 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-11-04 21:14:22 +0000 |
commit | a1b680597178df866e6de80444695fab82b90492 (patch) | |
tree | 60cbd63325d8259537e2405caa2c2c9021bcd475 /gcc/d | |
parent | 63b7a614dddaddea738de266f11cbcdeee01076c (diff) | |
download | gcc-a1b680597178df866e6de80444695fab82b90492.zip gcc-a1b680597178df866e6de80444695fab82b90492.tar.gz gcc-a1b680597178df866e6de80444695fab82b90492.tar.bz2 |
[D] Remove unchecked to_constant in VECTOR_TYPE handling
The SVE port now tries to register variable-length VECTOR_TYPEs
at start-up, so it's no longer possible to use the asserting
to_constant on the number of vector elements. This patch punts
on variable element counts instead, just like we do for other
things that the frontend doesn't recognise.
The brace indentation matches the surrounding style.
2019-11-04 Richard Sandiford <richard.sandiford@arm.com>
gcc/d/
* d-builtins.cc (build_frontend_type): Cope with variable
TYPE_VECTOR_SUBPARTS.
From-SVN: r277793
Diffstat (limited to 'gcc/d')
-rw-r--r-- | gcc/d/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/d/d-builtins.cc | 25 |
2 files changed, 19 insertions, 11 deletions
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 1013c08..2591b4c 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,8 @@ +2019-11-04 Richard Sandiford <richard.sandiford@arm.com> + + * d-builtins.cc (build_frontend_type): Cope with variable + TYPE_VECTOR_SUBPARTS. + 2019-08-23 Jakub Jelinek <jakub@redhat.com> PR middle-end/91283 diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc index 2f7319c..2ad0f8b 100644 --- a/gcc/d/d-builtins.cc +++ b/gcc/d/d-builtins.cc @@ -197,20 +197,23 @@ build_frontend_type (tree type) break; case VECTOR_TYPE: + { + unsigned HOST_WIDE_INT nunits; + if (!TYPE_VECTOR_SUBPARTS (type).is_constant (&nunits)) + break; + dtype = build_frontend_type (TREE_TYPE (type)); - if (dtype) - { - poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (type); - dtype = dtype->sarrayOf (nunits.to_constant ())->addMod (mod); + if (!dtype) + break; - if (dtype->nextOf ()->isTypeBasic () == NULL) - break; + dtype = dtype->sarrayOf (nunits)->addMod (mod); + if (dtype->nextOf ()->isTypeBasic () == NULL) + break; - dtype = (TypeVector::create (Loc (), dtype))->addMod (mod); - builtin_converted_decls.safe_push (builtin_data (dtype, type)); - return dtype; - } - break; + dtype = (TypeVector::create (Loc (), dtype))->addMod (mod); + builtin_converted_decls.safe_push (builtin_data (dtype, type)); + return dtype; + } case RECORD_TYPE: { |