Go to file
Michael Gottesman c024f3258a Teach simplify-cfg how to correctly create covered lookup tables for switches on iN with N >= 3.
One optimization simplify-cfg performs is the converting of switches to
lookup tables if the switch has > 4 cases. This is done by:

1. Finding the max/min case value and calculating the switch case range.
2. Create a lookup table basic block.
3. Perform a check in the switch's BB to see if the input value is in
the switch's case range. If the input value satisfies said predicate
branch to the lookup table BB, otherwise branch to the switch's default
destination BB using the default value as the result.

The conditional check consists of subtracting the min case value of the
table from any input iN value and then ensuring that said value is
unsigned less than the size of the lookup table represented as an iN
value.

If the lookup table is a covered lookup table, the size of the table will be N
which is 0 as an iN value. Thus the comparison will be an `icmp ult` of an iN
value against 0 which is always false yielding the incorrect result.

This patch fixes this problem by recognizing if we have a covered lookup table
and if we do, unconditionally jumps to the lookup table BB since the covering
property of the lookup table implies no input values could not be handled by
said BB.

rdar://15268442

llvm-svn: 193045
2013-10-20 07:04:37 +00:00
clang Sema: Diagnose global replacement functions declared as inline 2013-10-20 05:40:29 +00:00
clang-tools-extra Refactoring transform-specific options 2013-10-17 17:57:36 +00:00
compiler-rt [asan] fix stack trace printing on Mac 2013-10-18 17:46:43 +00:00
debuginfo-tests don't use CHECK-NEXT because it may be on the same line. 2013-09-18 23:01:54 +00:00
libclc Port pocl's gen_convert.py script to libclc 2013-10-10 19:09:01 +00:00
libcxx r192075 broke the buildbot at 2013-10-14 18:02:02 +00:00
libcxxabi unwinder: conditionalise availability 2013-10-17 03:57:41 +00:00
lld Simplify WinLinkDriver. No functionality change. 2013-10-19 03:34:00 +00:00
lldb ValueObject and SBValue's GetChildMemberWithName should look through anonymous structs 2013-10-18 23:53:55 +00:00
llvm Teach simplify-cfg how to correctly create covered lookup tables for switches on iN with N >= 3. 2013-10-20 07:04:37 +00:00
openmp Update web pages to include style sheets and referenced documents missed before. 2013-10-03 11:55:28 +00:00
polly clang-format: No empty line after 'public:' 2013-10-15 14:41:02 +00:00