llvm-6502/include/llvm/Analysis
Shuxin Yang 5e915e6e36 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185843 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 17:33:13 +00:00
..
AliasAnalysis.h Make BasicAliasAnalysis recognize the fact a noalias argument cannot alias another argument, even if the other argument is not itself marked noalias. 2013-05-28 08:17:48 +00:00
AliasSetTracker.h Remove unneeded #includes. 2013-03-18 23:33:44 +00:00
BlockFrequencyImpl.h Try to unbreak Linux buildbots. 2013-06-28 22:54:16 +00:00
BlockFrequencyInfo.h BlockFrequency: Bump up the entry frequency a bit. 2013-06-25 13:34:40 +00:00
BranchProbabilityInfo.h Add a new function attribute 'cold' to functions. 2013-05-24 12:26:52 +00:00
CallGraph.h
CallGraphSCCPass.h
CallPrinter.h
CaptureTracking.h Remove unneeded #includes. Use forward declarations instead. 2013-03-10 00:34:01 +00:00
CFGPrinter.h
CodeMetrics.h Switch CodeMetrics itself over to use TTI to determine if an instruction 2013-01-21 13:04:33 +00:00
ConstantFolding.h Add missing -*- C++ -*- to headers 2013-05-17 21:43:39 +00:00
ConstantsScanner.h
DependenceAnalysis.h extending the interface of Dependence slightly to support future work 2013-06-28 23:34:23 +00:00
DominanceFrontier.h
DominatorInternals.h
Dominators.h Add some constantness. 2013-03-05 22:01:15 +00:00
DomPrinter.h
DOTGraphTraitsPass.h
FindUsedTypes.h
InlineCost.h Remove unneeded #include. 2013-06-06 23:34:11 +00:00
InstructionSimplify.h Document another instsimplify assumption. 2013-01-31 22:13:00 +00:00
Interval.h
IntervalIterator.h Fix a few typos in comments. 2013-03-05 22:05:16 +00:00
IntervalPartition.h
IVUsers.h Remove duplicated forward declaration. 2013-03-06 00:04:32 +00:00
LazyValueInfo.h
LibCallAliasAnalysis.h
LibCallSemantics.h
Lint.h
Loads.h
LoopInfo.h Add support for llvm.vectorizer metadata 2013-05-28 20:00:34 +00:00
LoopInfoImpl.h Remove #includes from the commonly used LoopInfo.h. 2013-02-09 01:04:28 +00:00
LoopIterator.h Remove unneeded #includes. 2013-02-09 13:29:10 +00:00
LoopPass.h
MemoryBuiltins.h Revert r176408 and r176407 to address PR15540. 2013-04-09 18:16:05 +00:00
MemoryDependenceAnalysis.h Memory Dependence Analysis (not mem-dep test) take advantage of "invariant.load" metadata. 2013-03-06 17:48:48 +00:00
Passes.h Remove -print-dbginfo as it is unused & bitrotten. 2013-03-08 18:17:46 +00:00
PathNumbering.h
PathProfileInfo.h
PHITransAddr.h
PostDominators.h Add a const version of findNearestCommonDominator to PostDom for convenience. 2013-06-09 15:09:30 +00:00
ProfileDataLoader.h
ProfileDataTypes.h
ProfileInfo.h
ProfileInfoLoader.h
ProfileInfoTypes.h
PtrUseVisitor.h
RegionInfo.h RegionInfo: Add helpers to replace entry/exit recursively 2013-04-10 06:54:49 +00:00
RegionIterator.h
RegionPass.h Fix a typo (ouput => output) 2013-05-17 12:31:43 +00:00
RegionPrinter.h
ScalarEvolution.h Fix a SCEV update problem. 2013-07-08 17:33:13 +00:00
ScalarEvolutionExpander.h
ScalarEvolutionExpressions.h Pacify -Wnon-virtual-dtor 2013-02-15 23:51:59 +00:00
ScalarEvolutionNormalization.h
SparsePropagation.h
TargetTransformInfo.h Loop Strength Reduce: Scaling factor cost. 2013-05-31 21:29:03 +00:00
Trace.h
ValueTracking.h Move isKnownNonNull out of AliasAnalysis.h and into ValueTracking.cpp since 2013-01-31 02:40:59 +00:00
Verifier.h