1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 13:02:52 +02:00
llvm-mirror/lib
Chandler Carruth 2a5f3cfadc [SROA] Fix another instability in SROA with respect to the slice
ordering.

The fundamental problem that we're hitting here is that the use-def
chain ordering is *itself* not a stable thing to be relying on in the
rewriting for SROA. Further, we use a non-stable sort over the slices to
arrange them based on the section of the alloca they're operating on.
With a debugging STL implementation (or different implementations in
stage2 and stage3) this can cause stage2 != stage3.

The specific aspect of this problem fixed in this commit deals with the
rewriting and load-speculation around PHIs and Selects. This, like many
other aspects of the use-rewriting in SROA, is really part of the
"strong SSA-formation" that is doen by SROA where it works very hard to
canonicalize loads and stores in *just* the right way to satisfy the
needs of mem2reg[1]. When we have a select (or a PHI) with 2 uses of the
same alloca, we test that loads downstream of the select are
speculatable around it twice. If only one of the operands to the select
needs to be rewritten, then if we get lucky we rewrite that one first
and the select is immediately speculatable. This can cause the order of
operand visitation, and thus the order of slices to be rewritten, to
change an alloca from promotable to non-promotable and vice versa.

The fix is to defer all of the speculation until *after* the rewrite
phase is done. Once we've rewritten everything, we can accurately test
for whether speculation will work (once, instead of twice!) and the
order ceases to matter.

This also happens to simplify the other subtlety of speculation -- we
need to *not* speculate anything unless the result of speculating will
make the alloca fully promotable by mem2reg. I had a previous attempt at
simplifying this, but it was still pretty horrible.

There is actually already a *really* nice test case for this in
basictest.ll, but on multiple STL implementations and inputs, we just
got "lucky". Fortunately, the test case is very small and we can
essentially build it in exactly the opposite way to get reasonable
coverage in both directions even from normal STL implementations.

llvm-svn: 202092
2014-02-25 00:07:09 +00:00
..
Analysis Make some DataLayout pointers const. 2014-02-24 23:12:18 +00:00
AsmParser [ms-cxxabi] Add a new calling convention that swaps 'this' and 'sret' 2014-01-31 17:41:22 +00:00
Bitcode Replace the F_Binary flag with a F_Text one. 2014-02-24 18:20:12 +00:00
CodeGen Add missing const 2014-02-24 21:01:18 +00:00
DebugInfo llvm-dwarfdump: Support for debug_line.dwo section for file names for type units under fission. 2014-02-24 23:58:54 +00:00
ExecutionEngine move getNameWithPrefix and getSymbol to TargetMachine. 2014-02-19 20:30:41 +00:00
IR Replace the F_Binary flag with a F_Text one. 2014-02-24 18:20:12 +00:00
IRReader Make parseBitcodeFile return an ErrorOr<Module *>. 2014-01-15 01:08:23 +00:00
LineEditor Avoid using EL_GETFP. 2014-02-04 20:04:46 +00:00
Linker Set the SuppressWarnings option on tool level and propagate to the library. 2014-02-20 22:19:24 +00:00
LTO Replace the F_Binary flag with a F_Text one. 2014-02-24 18:20:12 +00:00
MC Replace the F_Binary flag with a F_Text one. 2014-02-24 18:20:12 +00:00
Object MC: Support COFF string tables larger than 10MB 2014-02-22 16:12:20 +00:00
Option Avoid buffer copies when a Twine already is a StringRef. 2013-12-03 18:18:28 +00:00
Support Replace the F_Binary flag with a F_Text one. 2014-02-24 18:20:12 +00:00
TableGen Replace the F_Binary flag with a F_Text one. 2014-02-24 18:20:12 +00:00
Target Make some DataLayout pointers const. 2014-02-24 23:12:18 +00:00
Transforms [SROA] Fix another instability in SROA with respect to the slice 2014-02-25 00:07:09 +00:00
CMakeLists.txt Introduce line editor library. 2014-01-31 23:46:14 +00:00
LLVMBuild.txt Introduce line editor library. 2014-01-31 23:46:14 +00:00
Makefile Introduce line editor library. 2014-01-31 23:46:14 +00:00