fold-const.h (get_array_ctor_element_at_index): Adjust.
authorRichard Biener <rguenther@suse.de>
Fri, 12 Jul 2019 10:03:10 +0000 (10:03 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 12 Jul 2019 10:03:10 +0000 (10:03 +0000)
commit831e688af50c5f77a2daa3cd3bfd0f27d54d5d72
treeea4a80650c7c4334d9576ee571c395e345cfec8a
parente067f9924bad423bf6265b75414d3160e6cf660a
fold-const.h (get_array_ctor_element_at_index): Adjust.

2019-07-12  Richard Biener  <rguenther@suse.de>

* fold-const.h (get_array_ctor_element_at_index): Adjust.
* fold-const.c (get_array_ctor_element_at_index): Add
ctor_idx output parameter informing the caller where in
the constructor the element was (not) found.  Add early exit
for when the ctor is sorted.
* gimple-fold.c (fold_array_ctor_reference): Support constant
folding across multiple array elements.

* gcc.dg/tree-ssa/vector-7.c: New testcase.

From-SVN: r273435
gcc/ChangeLog
gcc/fold-const.c
gcc/fold-const.h
gcc/gimple-fold.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/vector-7.c [new file with mode: 0644]