On Tue, May 9, 2017 at 7:54 PM, Peter Bergner <berg...@vnet.ibm.com> wrote: > Here is the updated patch to use gimple_seq_unreachable_p() which scans the > sequence backwards so it bails out earlier in the common case (ie, no call > to __builtin_unreachable). As discussed in the previous thread, we remove > case statement labels from the jump table that lead to unreachable blocks, > which leads to fewer compare/branches in the decision tree case and > possibly a smaller jump table in the jump table case. Unreachable default > case statements are only handled here when generating a jump table, since > the current code for decision trees seems to prefer the status quo. We can > revisit this later if someone finds a test case that would benefit from > handling it for decision trees too. > > This passes bootstrap and regtesting on powerpc64le-linux and x86_64-linux > with no regressions. Ok for trunk now? > > Peter > > gcc/ > * tree-cfg.c (gimple_seq_unreachable_p): New function. > (assert_unreachable_fallthru_edge_p): Use it. > (group_case_labels_stmt): Likewise. > * tree-cfg.h: Prototype it. > * stmt.c: Include cfghooks.h and tree-cfg.h. > (emit_case_dispatch_table) <gap_label>: New local variable. > Use it to fill dispatch table gaps. > Test for default_label before updating probabilities. > (expand_case) <default_label>: Remove unneeded initialization. > Test for unreachable default case statement and remove its edge. > Set default_label accordingly. > * tree-ssa-ccp.c (optimize_unreachable): Update comment. > > gcc/testsuite/ > * gcc.target/powerpc/pr51513.c: New test. > * gcc.dg/predict-13.c: Replace __builtin_unreachable() with > __builtin_abort(). > * gcc.dg/predict-14.c: Likewise. >
This caused: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80714 H.J.