This patch adds an inst-combine optimization which narrows the operands of a switch instruction if the upper bits are known to be all 1 or 0.
For example, since the upper 32-bits are all zero in the following switch instruction,
%and = and i64 %a, 4294967295
switch i64 %and, label %sw.default [
i64 10, label %return i64 100, label %sw.bb1 i64 1001, label %sw.bb2
]
we can turn it into a 32-bit instruction:
switch i32 %and, label %sw.default [
i32 10, label %return i32 100, label %sw.bb1 i32 1001, label %sw.bb2
]