[patch] PR tree-optimization/96818 - cast label range to type of switch operand

Aldy Hernandez aldyh@redhat.com
Mon Aug 31 08:20:32 GMT 2020

As discussed in the PR, the type of a switch operand may be different 
than the type of the individual cases.  This is causing us to attempt to 
intersect incompatible ranges.

This inconsistent IL seems wrong to me, but it also seems pervasive 
throughout GCC.  Jason, as one of the original gimple designers, do you 
remember if this was an oversight, or was there a reason for this?

Richard, you mention in the PR that normalizing the IL would cause 
propagation of widening cast sources into switches harder.  Couldn't we 
just cast all labels to the switch operand type upon creation?  What 
would be the problem with that?  Would we generate sub-optimal code?

In either case, I'd hate to leave trunk in a broken case while this is 
being discussed.  The attached patch fixes the PRs.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-PR-tree-optimization-96818-cast-label-range-to-type-.patch
Type: text/x-patch
Size: 2133 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200831/8ad6f4f9/attachment.bin>

More information about the Gcc-patches mailing list