1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/include/llvm
Shuxin Yang a6173e9a56 Fix a SCEV update problem.
The symptom is seg-fault, and the root cause is that a SCEV contains a SCEVUnknown
which has null-pointer to a llvm::Value.

 This is how the problem take place:
 ===================================
  1). In the pristine input IR, there are two relevant instrutions Op1 and Op2, 
     Op1's corresponding SCEV (denoted as SCEV(op1)) is a SCEVUnknown, and
     SCEV(Op2) contains SCEV(Op1).  None of these instructions are dead.

     Op1 : V1 = ...
     ...
     Op2 : V2 = ... // directly or indirectly (data-flow) depends on Op1
    
  2) Optimizer (LSR in my case) generates an instruction holding the equivalent
     value of Op1, making Op1 dead. 
     Op1': V1' = ...
     Op1: V1 = ... ; now dead)
     Op2 : V2 = ... //Now deps on Op1', but the SCEV(Op2) still contains SCEV(Op1)

  3) Op1 is deleted, and call-back function is called to reset 
     SCEV(Op1) to indicate it is invalid. However, SCEV(Op2) is not 
     invalidated as well.

  4) Following pass get the cached, invalid SCEV(Op2), and try to manipulate it,
     and cause segfault. 

 The fix:
 ========
 It seems there is no clean yet inexpensive fix. I write to dev-list
soliciting good solution, unforunately no ack. So, I decide to fix this 
problem in a brute-force way:

  When ScalarEvolution::getSCEV is called, check if the cached SCEV 
contains a invalid SCEVUnknow, if yes, remove the cached SCEV, and
re-evaluate the SCEV from scratch.

  I compile buch of big *.c and *.cpp, fortunately, I don't see any increase
in compile time.

 Misc:
=====
 The reduced test-case has 2357 lines of code+other-stuff, too big to commit.

 rdar://14283433

llvm-svn: 185843
2013-07-08 17:33:13 +00:00
..
ADT Revert "Revert "[APFloat] Removed APFloat constructor which initialized to either zero/NaN but allowed you to arbitrarily set the category of the float."" 2013-06-27 21:58:19 +00:00
Analysis Fix a SCEV update problem. 2013-07-08 17:33:13 +00:00
Assembly Enable *BasicBlockPass::createPrinterPass() 2013-02-08 23:37:41 +00:00
Bitcode Move lib/Archive to tools/llvm-ar. 2013-06-17 15:47:20 +00:00
CodeGen Remove dead function. 2013-07-05 23:04:55 +00:00
Config Reapply r185601 with a fix for the cmake build. 2013-07-04 01:10:38 +00:00
DebugInfo llvm-dwarfdump: Add support for dumping the .debug_loc section 2013-06-19 21:37:13 +00:00
ExecutionEngine Revising the MCJIT ObjectCache interface to allow subclasses to avoid retaining references to returned objects 2013-06-28 21:40:16 +00:00
IR Add missing per-argument doesNotAccessMemory accessors. No functionality change 2013-07-07 08:29:51 +00:00
IRReader Split out the IRReader header and the utility functions it provides into 2013-03-26 02:25:37 +00:00
MC MC: Implement COFF .linkonce directive 2013-07-06 12:13:10 +00:00
Object Use the raw member names in Archive::Archive. 2013-07-05 03:35:15 +00:00
Option Merge changes to clang's Driver code into LLVM's Option library 2013-06-13 18:12:12 +00:00
Support Revert: "Use Clang's __has_* macros in Compiler.h to test for features" 2013-07-08 17:32:13 +00:00
TableGen Fix up some asserts that are within an if statement. This removes the need 2013-07-01 23:42:53 +00:00
Target [SystemZ] Remove no-op MVCs 2013-07-05 14:38:48 +00:00
Transforms Remove limitation on DebugIR that made it require existing debug metadata. 2013-06-28 19:05:23 +00:00
AutoUpgrade.h
CMakeLists.txt
DebugInfo.h Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size. 2013-07-03 15:07:05 +00:00
DIBuilder.h Rename DIBuilder::createNullPtrType to createUnspecifiedType and introduce 2013-06-27 22:50:59 +00:00
GVMaterializer.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
InitializePasses.h Remove the simplify-libcalls pass (finally) 2013-06-20 19:48:07 +00:00
InstVisitor.h
LinkAllIR.h Rename LinkAllVMCore.h to LinkAllIR.h since VMCore directory was renamed to IR. 2013-01-10 21:55:02 +00:00
LinkAllPasses.h Remove the simplify-libcalls pass (finally) 2013-06-20 19:48:07 +00:00
Linker.h Fix a performance bug in the Linker. 2013-05-04 05:05:18 +00:00
Pass.h
PassAnalysisSupport.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
PassManager.h This patch breaks up Wrap.h so that it does not have to include all of 2013-05-01 20:59:00 +00:00
PassManagers.h Use a DenseMap instead of a std::map for AnalysisID -> Pass* maps. This reduces the pass-manager overhead from FPPassManager::runOnFunction() by about 10%. 2013-02-26 01:31:59 +00:00
PassRegistry.h This patch breaks up Wrap.h so that it does not have to include all of 2013-05-01 20:59:00 +00:00
PassSupport.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00