https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103278
Bug ID: 103278 Summary: [12 Regression] Recent change to cddce inhibits switch optimization Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: law at gcc dot gnu.org Target Milestone: --- On iq2000-elf this change: commit 045206450386bcd774db3bde0c696828402361c6 Author: Richard Biener <rguent...@suse.de> Date: Fri Nov 12 10:21:22 2021 +0100 tree-optimization/102880 - improve CD-DCE [ ... ] Is inhibiting switch optimization for tree-ssa/if-to-switch-3.c from converting an if statement into a switch statement: /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-iftoswitch-optimized" } */ int IsMySuperRandomChar(int aChar) { return aChar == 0x0009 || aChar == 0x000A || aChar == 0x000C || aChar == 0x000D || aChar == 0x0020 || aChar == 0x0030; } /* { dg-final { scan-tree-dump "Condition chain with \[^\n\r]\* BBs transformed into a switch statement." "iftoswitch" } } */ After today's cd-dce change we no longer turn that into a switch: Before: ;; Canonical GIMPLE case clusters: 9-10 12 13 32 48 ;; JT can be built: JT(values:6 comparisons:10 range:40 density: 25.00%):9-48 j.c:8:26: optimized: Condition chain with 3 BBs transformed into a switch statement. After: ;; Canonical GIMPLE case clusters: 9-10 12-13 32 48