llvm-6502/lib
Mark Heffernan fbd746614d This change fixes three bugs in loop unswitching. This change causes an 81% speed-up on a benchmark that is based on EigenConvolutionKernel2D from Eigen3, where the lack of loop unswitching blocks hoisting of loads out of a nested loop (see bug 23816 for how loop unswitching and load hoisting are related).
Change 1: Unswitching on trivial conditions should always happen regardless of the computed unswitching cost, as really the cost is zero. While there is code to make that happen, the logic that checks the unswitching cost against a threshold was moved to an earlier point (revision 147935) than the point where trivial unswitching is detected, so trivial unswitching is currently blocked by the cost threshold. This change fixes that.

Change 2: Before revision 147935 (from 2012-01-11), the threshold parameter was a per-loop threshold. So an unswitching happened only if the cost of the unswitching was less than the threshold. In an indirect way (and I believe unintentionally), the logic for this since then has been that the threshold is an over-all budget across all loops for all loop unswitching done by a given LoopUnswitch loop pass object. So if an unswitching with cost 100 happens in one function, that in effect reduces the threshold from 100 to 0 for the loops even in another function. This persists for the lifetime of that loop pass object. This makes no difference for most small examples but it is important for large examples. This revision fixes that.

Change 3: The cost is currently calculated as std::min(NumInstructions, 5 * NumBlocks). So a loop with 2 blocks and a million instructions will have an unswitching cost of 10. I changed this to just NumInstructions, as it were before revision 147935, though I'm open to e.g. instead replacing std::min with std::max.

I've tried to make the change minimally invasive while staying with what I think was the original intent of the code.
Submitted on behalf of broune@.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240438 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 18:26:50 +00:00
..
Analysis
AsmParser ADT: Add a string APSInt constructor. 2015-06-23 18:22:10 +00:00
Bitcode
CodeGen MIR Serialization: Serialize physical register machine operands. 2015-06-23 16:35:26 +00:00
DebugInfo
ExecutionEngine Be sure to set the DataLayout before checking the cache. 2015-06-23 14:42:34 +00:00
Fuzzer
IR Remove unused arguments and move ManglerPrefixTy to the implementation. 2015-06-23 14:11:09 +00:00
IRReader
LibDriver
LineEditor
Linker
LTO Simplify the Mangler interface now that DataLayout is mandatory. 2015-06-23 13:59:29 +00:00
MC Revert r240302 ("Bring r240130 back."). 2015-06-23 11:31:32 +00:00
Object Make helper functions static. NFC. 2015-06-23 14:51:40 +00:00
Option [Option] Plug a leak when move-assigning an InputArgList. 2015-06-23 15:28:10 +00:00
Passes
ProfileData
Support ADT: Add a string APSInt constructor. 2015-06-23 18:22:10 +00:00
TableGen
Target [ARM] ARMLoadStoreOpt::UpdateBaseRegUses should stop on def 2015-06-23 16:02:11 +00:00
Transforms This change fixes three bugs in loop unswitching. This change causes an 81% speed-up on a benchmark that is based on EigenConvolutionKernel2D from Eigen3, where the lack of loop unswitching blocks hoisting of loads out of a nested loop (see bug 23816 for how loop unswitching and load hoisting are related). 2015-06-23 18:26:50 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile