llvm-project/llvm/lib
Philip Reames 971dc3a82a [RewriteStatepointsForGC] Avoid using unrelocated pointers after safepoints
To be clear: this is an *optimization* not a correctness change.

CodeGenPrep likes to duplicate icmps feeding branch instructions to take advantage of x86's ability to fuze many comparison/branch patterns into a single micro-op and to reduce the need for materializing i1s into general registers. PlaceSafepoints likes to place safepoint polls right at the end of basic blocks (immediately before terminators) when inserting entry and backedge safepoints. These two heuristics interact in a somewhat unfortunate way where the branch terminating the original block will be controlled by a condition driven by unrelocated pointers. This forces the register allocator to keep both the relocated and unrelocated values of the pointers feeding the icmp alive over the safepoint poll.

One simple fix would have been to just adjust PlaceSafepoints to move one back in the basic block, but you can reach similar cases as a result of LICM or other hoisting passes. As a result, doing a post insertion fixup seems to be more robust.

I considered doing this in CodeGenPrep itself, but having to update the live sets of already rewritten safepoints gets complicated fast. In particular, you can't just use def/use information because by moving the icmp, we're extending the live range of it's inputs potentially.

Instead, this patch teaches RewriteStatepointsForGC to make the required adjustments before making the relocations explicit in the IR. This change really highlights the fact that RSForGC is a CodeGenPrep-like pass which is performing target specific lowering. In the long run, we may even want to combine the two though this would require a lot more smarts to be integrated into RSForGC first. We currently rely on being able to run a set of cleanup passes post rewriting because the IR RSForGC generates is pretty damn ugly.

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

llvm-svn: 244821
2015-08-12 22:11:45 +00:00
..
Analysis [PM/AA] Add missing static dependency edges from DSE and memdep to TLI. 2015-08-12 18:10:45 +00:00
AsmParser Fix with a bit more care. (but only a bit) 2015-08-03 20:55:00 +00:00
Bitcode Rangify for loop, NFC. 2015-08-10 07:04:29 +00:00
CodeGen MIR Parser: Allow the MI IR references to reference global values. 2015-08-12 21:27:16 +00:00
DebugInfo Fix some comment typos. 2015-08-08 18:27:36 +00:00
ExecutionEngine [RuntimeDyld][AArch64] Add explicit addends before calling relocationValueRef. 2015-08-11 06:27:53 +00:00
Fuzzer Fix missing space in libfuzzer's help text. 2015-08-12 20:00:10 +00:00
IR [IR] Verify EH pad predecessors 2015-08-11 02:48:30 +00:00
IRReader Return a unique_ptr from getLazyBitcodeModule and parseBitcodeFile. NFC. 2015-06-16 22:27:55 +00:00
LTO Remove access to the DataLayout in the TargetMachine 2015-07-24 16:04:22 +00:00
LibDriver LibDriver: Replace references to lld-link2 with lld-link. 2015-08-06 19:00:42 +00:00
LineEditor Use ADDITIONAL_HEADER_DIRS in all LLVM CMake projects. 2015-02-11 03:28:02 +00:00
Linker Linker: Move distinct MDNodes instead of cloning 2015-08-03 17:09:38 +00:00
MC Silence a sign mismatch warning; NFC. 2015-08-10 15:22:39 +00:00
Object Convert getSymbolSection to return an ErrorOr. 2015-08-07 23:27:14 +00:00
Option Add an ArgList::AddAllArgs that accepts a vector of OptSpecifier. 2015-07-29 17:34:41 +00:00
Passes [PM] Fixup for r231556 where I missed a dependency on intrinsics 2015-03-07 09:08:20 +00:00
ProfileData Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
Support Add model numbers for Skylake CPUs and an additional Broadwell model. 2015-08-08 01:29:15 +00:00
TableGen TableGen: Support folding casts from bits to int 2015-07-31 01:12:06 +00:00
Target WebAssembly: floating-point comparisons 2015-08-12 17:53:29 +00:00
Transforms [RewriteStatepointsForGC] Avoid using unrelocated pointers after safepoints 2015-08-12 22:11:45 +00:00
CMakeLists.txt LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00
LLVMBuild.txt Wrap some long lines in LLVMBuild files. NFC 2015-06-12 18:44:57 +00:00
Makefile LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00