mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
a6173e9a56
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 |
||
---|---|---|
.. | ||
AliasAnalysis.h | ||
AliasSetTracker.h | ||
BlockFrequencyImpl.h | ||
BlockFrequencyInfo.h | ||
BranchProbabilityInfo.h | ||
CallGraph.h | ||
CallGraphSCCPass.h | ||
CallPrinter.h | ||
CaptureTracking.h | ||
CFGPrinter.h | ||
CodeMetrics.h | ||
ConstantFolding.h | ||
ConstantsScanner.h | ||
DependenceAnalysis.h | ||
DominanceFrontier.h | ||
DominatorInternals.h | ||
Dominators.h | ||
DomPrinter.h | ||
DOTGraphTraitsPass.h | ||
FindUsedTypes.h | ||
InlineCost.h | ||
InstructionSimplify.h | ||
Interval.h | ||
IntervalIterator.h | ||
IntervalPartition.h | ||
IVUsers.h | ||
LazyValueInfo.h | ||
LibCallAliasAnalysis.h | ||
LibCallSemantics.h | ||
Lint.h | ||
Loads.h | ||
LoopInfo.h | ||
LoopInfoImpl.h | ||
LoopIterator.h | ||
LoopPass.h | ||
MemoryBuiltins.h | ||
MemoryDependenceAnalysis.h | ||
Passes.h | ||
PathNumbering.h | ||
PathProfileInfo.h | ||
PHITransAddr.h | ||
PostDominators.h | ||
ProfileDataLoader.h | ||
ProfileDataTypes.h | ||
ProfileInfo.h | ||
ProfileInfoLoader.h | ||
ProfileInfoTypes.h | ||
PtrUseVisitor.h | ||
RegionInfo.h | ||
RegionIterator.h | ||
RegionPass.h | ||
RegionPrinter.h | ||
ScalarEvolution.h | ||
ScalarEvolutionExpander.h | ||
ScalarEvolutionExpressions.h | ||
ScalarEvolutionNormalization.h | ||
SparsePropagation.h | ||
TargetTransformInfo.h | ||
Trace.h | ||
ValueTracking.h | ||
Verifier.h |