llvm-6502/lib/Transforms/Utils
Manman Ren 4cae9cb034 SimplifyCFG: fix a bug in switch to table conversion
We use gep to access the global array "switch.table", and the table index
should be treated as unsigned. When the highest bit is 1, this commit
zero-extends the index to an integer type with larger size.

For a switch on i2, we used to generate:
%switch.tableidx = sub i2 %0, -2
getelementptr inbounds [4 x i64]* @switch.table, i32 0, i2 %switch.tableidx

It is incorrect when %switch.tableidx is 2 or 3. The fix is to generate
%switch.tableidx = sub i2 %0, -2
%switch.tableidx.zext = zext i2 %switch.tableidx to i3
getelementptr inbounds [4 x i64]* @switch.table, i32 0, i3 %switch.tableidx.zext

rdar://17735071


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213815 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-23 23:13:23 +00:00
..
AddDiscriminators.cpp [C++] Use 'nullptr'. Transforms edition. 2014-04-25 05:29:35 +00:00
ASanStackFrameLayout.cpp Revert "Introduce a string_ostream string builder facilty" 2014-06-26 22:52:05 +00:00
BasicBlockUtils.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
BreakCriticalEdges.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
BuildLibCalls.cpp [C++] Use 'nullptr'. Transforms edition. 2014-04-25 05:29:35 +00:00
BypassSlowDivision.cpp [C++] Use 'nullptr'. Transforms edition. 2014-04-25 05:29:35 +00:00
CloneFunction.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
CloneModule.cpp Allow alias to point to an arbitrary ConstantExpr. 2014-06-03 02:41:57 +00:00
CMakeLists.txt Decouple llvm::SpecialCaseList text representation and its LLVM IR semantics. 2014-07-09 19:40:08 +00:00
CmpInstAnalysis.cpp [C++] Use 'nullptr'. Transforms edition. 2014-04-25 05:29:35 +00:00
CodeExtractor.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
CtorUtils.cpp Add comdat key field to llvm.global_ctors and llvm.global_dtors 2014-05-16 20:39:27 +00:00
DemoteRegToStack.cpp [C++] Use 'nullptr'. Transforms edition. 2014-04-25 05:29:35 +00:00
FlattenCFG.cpp [C++] Use 'nullptr'. Transforms edition. 2014-04-25 05:29:35 +00:00
GlobalStatus.cpp [C++] Use 'nullptr'. Transforms edition. 2014-04-25 05:29:35 +00:00
InlineFunction.cpp DebugInfo: Preserve debug location information when transforming a call into an invoke during inlining. 2014-06-30 20:30:39 +00:00
InstructionNamer.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-05 09:10:37 +00:00
IntegerDivision.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:55:47 +00:00
LCSSA.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:55:47 +00:00
LLVMBuild.txt LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
Local.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
LoopSimplify.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
LoopUnroll.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
LoopUnrollRuntime.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
LowerExpectIntrinsic.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:55:47 +00:00
LowerInvoke.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:55:47 +00:00
LowerSwitch.cpp Fixup PHIs in LowerSwitch when a Leaf node is not emitted. 2014-07-11 10:34:36 +00:00
Makefile
Mem2Reg.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:55:47 +00:00
MetaRenamer.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-05 09:10:37 +00:00
ModuleUtils.cpp Add comdat key field to llvm.global_ctors and llvm.global_dtors 2014-05-16 20:39:27 +00:00
PromoteMemoryToRegister.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
SimplifyCFG.cpp SimplifyCFG: fix a bug in switch to table conversion 2014-07-23 23:13:23 +00:00
SimplifyIndVar.cpp [C++] Use 'nullptr'. Transforms edition. 2014-04-25 05:29:35 +00:00
SimplifyInstructions.cpp RecursivelyDeleteTriviallyDeadInstructions() could remove 2014-04-26 05:58:11 +00:00
SimplifyLibCalls.cpp Add support for missed and analysis optimization remarks. 2014-05-22 14:19:46 +00:00
SSAUpdater.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
UnifyFunctionExitNodes.cpp [C++] Use 'nullptr'. Transforms edition. 2014-04-25 05:29:35 +00:00
Utils.cpp Pass to emit DWARF path discriminators. 2014-03-03 20:06:11 +00:00
ValueMapper.cpp [C++] Use 'nullptr'. Transforms edition. 2014-04-25 05:29:35 +00:00