llvm-6502/lib/Transforms/Utils
Philip Reames e00c0df2c4 Extend EarlyCSE to handle basic cases from JumpThreading and CVP
This patch extends EarlyCSE to take advantage of the information that a controlling branch gives us about the value of a Value within this and dominated basic blocks. If the current block has a single predecessor with a controlling branch, we can infer what the branch condition must have been to execute this block. The actual change to support this is downright simple because EarlyCSE's existing scoped hash table logic deals with most of the complexity around merging.

The patch actually implements two optimizations.
1) The first is analogous to JumpThreading in that it enables EarlyCSE's CSE handling to fold branches which are exactly redundant due to a previous branch to branches on constants. (It doesn't actually replace the branch or change the CFG.) This is pretty clearly a win since it enables substantial CFG simplification before we start trying to inline.
2) The second is analogous to CVP in that it exploits the knowledge gained to replace dominated *uses* of the original value. EarlyCSE does not otherwise reason about specific uses, so this is the more arguable one. It does enable further simplication and constant folding within the rest of the visit by EarlyCSE.

In both cases, the added code only handles the easy dominance based case of each optimization. The general case is deferred to the existing passes.

Differential Revision: http://reviews.llvm.org/D9763



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238071 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 23:53:24 +00:00
..
AddDiscriminators.cpp IR: Give 'DI' prefix to debug info metadata 2015-04-29 16:38:44 +00:00
ASanStackFrameLayout.cpp
BasicBlockUtils.cpp Convert PHI getIncomingValue() to foreach over incoming_values(). NFC. 2015-05-12 20:05:31 +00:00
BreakCriticalEdges.cpp
BuildLibCalls.cpp Simplify IRBuilder::CreateCall* by using ArrayRef+initializer_list/braced init only 2015-05-18 22:13:54 +00:00
BypassSlowDivision.cpp
CloneFunction.cpp IR: Give 'DI' prefix to debug info metadata 2015-04-29 16:38:44 +00:00
CloneModule.cpp [opaque pointer type] Pass GlobalAlias the actual pointer type rather than decomposing it into pointee type + address space 2015-04-29 21:22:39 +00:00
CMakeLists.txt [NFC] Refactor identification of reductions as common utility function. 2015-04-20 04:38:33 +00:00
CmpInstAnalysis.cpp
CodeExtractor.cpp
CtorUtils.cpp [ctorutils] Update and sort includes. NFC. 2015-03-23 19:06:17 +00:00
DemoteRegToStack.cpp
FlattenCFG.cpp
GlobalStatus.cpp [CallSite] Make construction from Value* (or Instruction*) explicit. 2015-04-10 14:50:08 +00:00
InlineFunction.cpp Simplify IRBuilder::CreateCall* by using ArrayRef+initializer_list/braced init only 2015-05-18 22:13:54 +00:00
InstructionNamer.cpp
IntegerDivision.cpp Simplify IRBuilder::CreateCall* by using ArrayRef+initializer_list/braced init only 2015-05-18 22:13:54 +00:00
LCSSA.cpp Removing dead code; NFC. This code was triggering a C4718 warning (recursive call has no side effects, deleting) with MSVC. 2015-04-24 12:51:45 +00:00
LLVMBuild.txt
Local.cpp Extend EarlyCSE to handle basic cases from JumpThreading and CVP 2015-05-22 23:53:24 +00:00
LoopSimplify.cpp Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used. 2015-03-23 19:32:43 +00:00
LoopUnroll.cpp [LoopUnrollRuntime] Avoid high-cost trip count computation. 2015-04-14 03:20:38 +00:00
LoopUnrollRuntime.cpp [LoopUnrollRuntime] Avoid high-cost trip count computation. 2015-04-14 03:20:38 +00:00
LoopUtils.cpp Move common loop utility function isInductionPHI into LoopUtils.cpp 2015-04-23 08:29:20 +00:00
LowerInvoke.cpp
LowerSwitch.cpp Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used. 2015-03-23 19:32:43 +00:00
Makefile
Mem2Reg.cpp
MetaRenamer.cpp
ModuleUtils.cpp Implement createSanitizerCtor, common helper function for all sanitizers 2015-05-06 18:48:22 +00:00
PromoteMemoryToRegister.cpp Move IDF Calculation to a separate file, expose an interface to it. 2015-04-21 19:13:02 +00:00
SimplifyCFG.cpp SimplifyCFG: Correctly handle switch lookup tables which fully cover the input type and use bit tests to check for holes 2015-04-24 20:57:56 +00:00
SimplifyIndVar.cpp SimplifyIV comments and dead argument cleanup. 2015-05-18 16:49:31 +00:00
SimplifyInstructions.cpp
SimplifyLibCalls.cpp Change Function::getIntrinsicID() to return an Intrinsic::ID. NFC. 2015-05-20 17:16:39 +00:00
SSAUpdater.cpp Change LoadAndStorePromoter to take ArrayRef instead of SmallVectorImpl&. 2015-05-13 01:12:16 +00:00
SymbolRewriter.cpp Purge unused includes throughout libSupport. 2015-03-23 18:07:13 +00:00
UnifyFunctionExitNodes.cpp
Utils.cpp
ValueMapper.cpp [opaque pointer type] Track explicit GEP pointee type through in-memory IR 2015-05-05 18:03:48 +00:00