Switch lowering: fix assert in buildBitTests (PR23738)
authorHans Wennborg <hans@hanshq.net>
Thu, 4 Jun 2015 15:55:00 +0000 (15:55 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 4 Jun 2015 15:55:00 +0000 (15:55 +0000)
commitd92291568586e13b1484cd720f6faf939f0b2623
tree99b8475e94455adc5fc6c8a9a16b2fa310101af3
parentc0aeadf92d8f8354f6e6f8f9a164f7bfbb106247
Switch lowering: fix assert in buildBitTests (PR23738)

When checking (High - Low + 1).sle(BitWidth), BitWidth would be truncated
to the size of the left-hand side. In the case of this PR, the left-hand
side was i4, so BitWidth=64 got truncated to 0 and the assert failed.

llvm-svn: 239048
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/X86/switch.ll