diff options
| author | Philip Reames <listmail@philipreames.com> | 2015-04-13 17:35:55 +0000 |
|---|---|---|
| committer | Philip Reames <listmail@philipreames.com> | 2015-04-13 17:35:55 +0000 |
| commit | 9a2e01d90875a08ce1bfcd8eeeda305195b3c85e (patch) | |
| tree | 3f2747217be695d1648f395ed7252af16d46c099 /llvm/lib | |
| parent | 038363370fd6d1f29ea42ff1179135625bc2180d (diff) | |
| download | bcm5719-llvm-9a2e01d90875a08ce1bfcd8eeeda305195b3c85e.tar.gz bcm5719-llvm-9a2e01d90875a08ce1bfcd8eeeda305195b3c85e.zip | |
[RewriteStatepointsForGC] Strengthen assertions around liveness
This is related to the issues addressed in 234651. These assertions check the properties ensured by that change at the place of use. Note that a similiar property is checked in checkBasicSSA, but without the reachability constraint. Technically, the liveness would be correct to include unreachable values, but this would be problematic for actual relocation.
llvm-svn: 234766
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index 1f2597c7426..b4752243b6a 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -1879,6 +1879,24 @@ static bool insertParsePoints(Function &F, DominatorTree &DT, Pass *P, Statepoint statepoint(info.StatepointToken); live.insert(live.end(), statepoint.gc_args_begin(), statepoint.gc_args_end()); +#ifndef NDEBUG + // Do some basic sanity checks on our liveness results before performing + // relocation. Relocation can and will turn mistakes in liveness results + // into non-sensical code which is must harder to debug. + // TODO: It would be nice to test consistency as well + assert(DT.isReachableFromEntry(info.StatepointToken->getParent()) && + "statepoint must be reachable or liveness is meaningless"); + for (Value *V : statepoint.gc_args()) { + if (!isa<Instruction>(V)) + // Non-instruction values trivial dominate all possible uses + continue; + auto LiveInst = cast<Instruction>(V); + assert(DT.isReachableFromEntry(LiveInst->getParent()) && + "unreachable values should never be live"); + assert(DT.dominates(LiveInst, info.StatepointToken) && + "basic SSA liveness expectation violated by liveness analysis"); + } +#endif } unique_unsorted(live); |

