OSDN Git Service

PR tree-optimization/45830
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Nov 2010 23:48:57 +0000 (23:48 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Nov 2010 23:48:57 +0000 (23:48 +0000)
commitdf2813c5d1134b21d1833567129a6aaafc52a3fd
treee65b38b3e2f234c14ced25bd4b7e019d0bf01d3f
parent021916134abceb9c085345986b4afd61eb066ef3
PR tree-optimization/45830
* stmt.c (expand_switch_using_bit_tests_p): New function.
(expand_case): Use it.
* tree.h (expand_switch_using_bit_tests_p): New prototype.
* tree-switch-conversion.c (struct switch_conv_info): Add
bit_test_uniq, bit_test_count and bit_test_bb fields.
(check_range): Fix a comment.
(check_process_case): Compute bit_test_uniq and bit_test_count.
(create_temp_arrays): Use XCNEWVEC, merge 3 arrays into one
allocation.
(free_temp_arrays): Use XDELETEVEC, adjust for the 3 arrays merging.
(constructor_contains_same_values_p): Use FOR_EACH_VEC_ELT.
(array_value_type): New function.
(build_one_array): Use it, if it returned different type,
fold_convert all constructor fields and convert back to the
wider type in the generated code.
(process_switch): Initialize bit_test_uniq, bit_test_count and
bit_test_bb fields.  Don't optimize if expand_switch_using_bit_tests_p
returned true.

* gcc.target/i386/pr45830.c: New test.
* gcc.c-torture/execute/pr45830.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166966 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr45830.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr45830.c [new file with mode: 0644]
gcc/tree-switch-conversion.c
gcc/tree.h