1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 11:33:24 +02:00
llvm-mirror/lib
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
..
Analysis Fix a SCEV update problem. 2013-07-08 17:33:13 +00:00
AsmParser Extend 'readonly' and 'readnone' to work on function arguments as well as 2013-07-06 00:29:58 +00:00
Bitcode Remove the Copied parameter from MemoryObject::readBytes. 2013-05-24 10:54:58 +00:00
CodeGen DebugInfo: Simplify Address Pool index handling. 2013-07-08 17:33:10 +00:00
DebugInfo Spell correct (s/begining/beginning/) 2013-06-19 21:42:05 +00:00
ExecutionEngine Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size. 2013-07-04 01:31:24 +00:00
IR Extend 'readonly' and 'readnone' to work on function arguments as well as 2013-07-06 00:29:58 +00:00
IRReader keep only the StringRef version of getFileOrSTDIN. 2013-06-25 05:28:34 +00:00
Linker Extend RemapInstruction and friends to take an optional new parameter, a ValueMaterializer. 2013-05-28 15:17:05 +00:00
MC Revert: Fix wrong code offset for unwind code SET_FPREG. 2013-07-08 04:48:34 +00:00
Object Remove a useless declarations (found by scan-build) 2013-07-05 15:58:12 +00:00
Option Fix a crash bug in dumping options with groups 2013-06-26 22:43:37 +00:00
Support We now always create files with the correct permissions. Simplify the interface. 2013-07-08 16:42:01 +00:00
TableGen keep only the StringRef version of getFileOrSTDIN. 2013-06-25 05:28:34 +00:00
Target PPC: Mark vector FREM as Expand by default 2013-07-08 17:30:25 +00:00
Transforms InstCombine: Fold X-C1 <u 2 -> (X & -2) == C1 2013-07-08 11:53:08 +00:00
CMakeLists.txt Move lib/Archive to tools/llvm-ar. 2013-06-17 15:47:20 +00:00
LLVMBuild.txt Move lib/Archive to tools/llvm-ar. 2013-06-17 15:47:20 +00:00
Makefile Move lib/Archive to tools/llvm-ar. 2013-06-17 15:47:20 +00:00