Improve forward jump threading of switch statements (PR18046)
authorPatrick Palka <ppalka@gcc.gnu.org>
Fri, 5 Aug 2016 23:29:53 +0000 (23:29 +0000)
committerPatrick Palka <ppalka@gcc.gnu.org>
Fri, 5 Aug 2016 23:29:53 +0000 (23:29 +0000)
commit5c3e5002db1096170c8dd33413842e91bfcb61d8
tree79bec8abe360b6fb22f3048f60ff643598e1a6b3
parentb10d44efe5bb64662a55fe74696b8c2ca2d17303
Improve forward jump threading of switch statements (PR18046)

gcc/ChangeLog:

PR tree-optimization/18046
* tree-ssa-threadedge.c: Include cfganal.h.
(simplify_control_statement_condition): If simplifying a
GIMPLE_SWITCH, replace the index operand of the GIMPLE_SWITCH
with the dominating ASSERT_EXPR before handing it off to VRP.
Mention that a CASE_LABEL_EXPR may be returned.
(thread_around_empty_blocks): Adjust to handle
simplify_control_statement_condition() returning a
CASE_LABEL_EXPR.
(thread_through_normal_block): Likewise.
* tree-vrp.c (simplify_stmt_for_jump_threading): Simplify
a switch statement by trying to determine which case label
will be taken.

gcc/testsuite/ChangeLog:

PR tree-optimization/18046
* gcc.dg/tree-ssa/vrp105.c: New test.
* gcc.dg/tree-ssa/vrp106.c: New test.

From-SVN: r239181
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/vrp105.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/vrp106.c [new file with mode: 0644]
gcc/tree-ssa-threadedge.c
gcc/tree-vrp.c