1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/lib
Michael Gottesman f056facc24 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
..
Analysis SCEV should use NSW to get trip count for positive nonunit stride loops. 2013-10-18 23:43:53 +00:00
AsmParser Add a GlobalAlias::isValidLinkage to reduce code duplication. 2013-10-09 16:07:32 +00:00
Bitcode Update comment list of GLOBALVAR modifiers in BitcodeWriter to include externally_initialized. 2013-10-14 22:36:51 +00:00
CodeGen Emit prefix data after debug and EH directives. 2013-10-20 02:16:21 +00:00
DebugInfo Correct log message typo: ended ad -> ended at 2013-10-18 13:01:33 +00:00
ExecutionEngine Avoid duplicate search by reusing the iterator. 2013-10-19 09:04:26 +00:00
IR Changing DebugInfoFinder to iterate over all the compile units. 2013-10-17 10:27:12 +00:00
IRReader Add 'const' qualifiers to static const char* variables. 2013-07-16 01:17:10 +00:00
Linker Add a 'deleteModule' method to the Linker class. 2013-10-16 08:59:57 +00:00
LTO Add a 'deleteModule' method to the Linker class. 2013-10-16 08:59:57 +00:00
MC Emit DWARF line entries for all data in the instruction stream. 2013-10-20 02:16:18 +00:00
Object Path: Recognize Windows compiled resource file. 2013-10-15 22:45:38 +00:00
Option Fix another mistake in r190442. 2013-09-10 23:22:56 +00:00
Support Can we move to C++11 already? 2013-10-18 23:07:01 +00:00
TableGen Add an error check for a typo I accidentally made in a td file that caused an assert to fire. 2013-08-20 04:22:09 +00:00
Target Mark some command line flags as hidden 2013-10-18 23:38:13 +00:00
Transforms 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
CMakeLists.txt Move LTO support library to a component, allowing it to be tested 2013-09-24 23:52:22 +00:00
LLVMBuild.txt Move LTO support library to a component, allowing it to be tested 2013-09-24 23:52:22 +00:00
Makefile Move LTO support library to a component, allowing it to be tested 2013-09-24 23:52:22 +00:00