1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/lib
Chandler Carruth 14f567c031 [PM] Fix new LoopUnroll function pass by invalidating loop analysis
results when a loop is completely removed.

This is very hard to manifest as a visible bug. You need to arrange for
there to be a subsequent allocation of a 'Loop' object which gets the
exact same address as the one which the unroll deleted, and you need the
LoopAccessAnalysis results to be significant in the way that they're
stale. And you need a million other things to align.

But when it does, you get a deeply mysterious crash due to actually
finding a stale analysis result. This fixes the issue and tests for it
by directly checking we successfully invalidate things. I have not been
able to get *any* test case to reliably trigger this. Changes to LLVM
itself caused the only test case I ever had to cease to crash.

I've looked pretty extensively at less brittle ways of fixing this and
they are actually very, very hard to do. This is a somewhat strange and
unusual case as we have a pass which is deleting an IR unit, but is not
running within that IR unit's pass framework (which is what handles this
cleanly for the normal loop unroll). And where there isn't a definitive
way to clear *all* of the stale cache entries. And where the pass *is*
updating the core analysis that provides the IR units!

For example, we don't have any of these problems with Function analyses
because it is easy to clear out function analyses when the functions
themselves may have been deleted -- we clear an entire module's worth!
But that is too heavy of a hammer down here in the LoopAnalysisManager
layer.

A better long-term solution IMO is to require that AnalysisManager's
make their keys durable to this kind of thing. Specifically, when
caching an analysis for one IR unit that is conceptually "owned" by
a higher level IR unit, the AnalysisManager should incorporate this into
its data structures so that we can reliably clear these results without
having to teach each and every pass to do so manually as we do here. But
that is a change for another day as it will be a fairly invasive change
to the AnalysisManager infrastructure. Until then, this fortunately
seems to be quite rare.

llvm-svn: 310333
2017-08-08 02:24:20 +00:00
..
Analysis [LCG] Remove yet another variable only used inside of asserts. 2017-08-05 08:33:16 +00:00
AsmParser
BinaryFormat
Bitcode
CodeGen [x86] revert r310208 to investigate test-suite failures (PR34105 / PR34097) 2017-08-07 15:47:48 +00:00
DebugInfo [DebugInfo][DWARF] Address paulr's comment on rL310253. 2017-08-07 16:08:11 +00:00
Demangle
ExecutionEngine
Fuzzer [libFuzzer] simplify code, NFC 2017-08-08 00:17:20 +00:00
IR
IRReader
LineEditor
Linker
LTO
MC
Object
ObjectYAML
Option
Passes Move the SampleProfileLoader right after EarlyFPM. 2017-08-07 20:23:20 +00:00
ProfileData
Support [Support] Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on Windows 2017-08-04 21:52:00 +00:00
TableGen
Target [AMDGPU] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-08-08 00:47:13 +00:00
Testing
ToolDrivers [llvm-dlltool] Map the "arm64" machine type 2017-08-06 19:58:13 +00:00
Transforms [PM] Fix new LoopUnroll function pass by invalidating loop analysis 2017-08-08 02:24:20 +00:00
WindowsManifest
XRay
CMakeLists.txt
LLVMBuild.txt