llvm-project/llvm/lib/Transforms
Philip Reames 5937368d4f [LICM] Remove unneccessary safety check to increase sinking effectiveness
This one requires a bit of explaination.  It's not every day you simply delete code to implement an optimization.  :)

The transform in question is sinking an instruction from a loop to the uses in loop exiting blocks.  We know (from LCSSA) that all of the uses outside the loop must be phi nodes, and after predecessor splitting, we know all phi users must have a single operand.  Since the use must be strictly dominated by the def, we know from the definition of dominance/ssa that the exit block must execute along a (non-strict) subset of paths which reach the def.  As a result, duplicating a potentially faulting instruction can not *introduce* a fault that didn't previously exist in the program.  

The full story is that this patch builds on "rL338671: [LICM] Factor out fault legality from canHoistOrSinkInst [NFC]" which pulled this logic out of a common helper routine.  As best I can tell, this check was originally added to the helper function for hoisting legality, later an incorrect fastpath for loads/calls was added, and then the bug was fixed by duplicating the fault safety check in the hoist path.  This left the redundant check in the common code to pessimize sinking for no reason.  I split it out in an NFC, and am not removing the unneccessary check.  I wanted there to be something easy to revert in case I missed something.

Reviewed by: Anna Thomas (in person)

llvm-svn: 338794
2018-08-03 00:21:56 +00:00
..
AggressiveInstCombine [LLVM-C] Fix name mangling on AggressiveInstCombine 2018-07-17 11:13:58 +00:00
Coroutines Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
Hello
IPO [NFC][FunctionAttrs] Remove duplication in old/new PM pipeline 2018-08-01 16:37:51 +00:00
InstCombine [InstSimplify] move minnum/maxnum with undef fold from instcombine 2018-08-02 14:33:40 +00:00
Instrumentation [ASAN] Use the correct shadow offset for ASAN on FreeBSD/mips64. 2018-08-01 22:51:13 +00:00
ObjCARC ProvenanceAnalysis: Store WeakTrackingVH instead of Value* in UnderlyingValue Cache. 2018-06-21 05:14:00 +00:00
Scalar [LICM] Remove unneccessary safety check to increase sinking effectiveness 2018-08-03 00:21:56 +00:00
Utils [SLC] Refactor simplification of pow() (NFC) 2018-08-02 15:43:57 +00:00
Vectorize [SLP] Fix PR38339: Instruction does not dominate all uses! 2018-07-31 14:02:43 +00:00
CMakeLists.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
LLVMBuild.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00