diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-26 20:32:52 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-26 20:32:52 +0000 | 
| commit | 08bbd35a80bf7765fe0d3043f9eb5a2f2786b649 (patch) | |
| tree | 80108f0f128657f8623f8f66ad9735b4d88e7b47 /lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | |
| parent | 7c7aba6e5fef47a01a136be655b0a92cfd7090f6 (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
| -rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 15 | 
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index dcccd17bb98e..f711ca71f79f 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -337,12 +337,13 @@ void SelectionDAGISel::getAnalysisUsage(AnalysisUsage &AU) const {  /// SplitCriticalSideEffectEdges - Look for critical edges with a PHI value that  /// may trap on it.  In this case we have to split the edge so that the path  /// through the predecessor block that doesn't go to the phi block doesn't -/// execute the possibly trapping instruction. If available, we pass a -/// dominator tree to be updated when we split critical edges. This is because -/// SelectionDAGISel preserves the DominatorTree. +/// execute the possibly trapping instruction. If available, we pass domtree +/// and loop info to be updated when we split critical edges. This is because +/// SelectionDAGISel preserves these analyses.  /// This is required for correctness, so it must be done at -O0.  /// -static void SplitCriticalSideEffectEdges(Function &Fn, DominatorTree *DT) { +static void SplitCriticalSideEffectEdges(Function &Fn, DominatorTree *DT, +                                         LoopInfo *LI) {    // Loop for blocks with phi nodes.    for (BasicBlock &BB : Fn) {      PHINode *PN = dyn_cast<PHINode>(BB.begin()); @@ -368,7 +369,7 @@ static void SplitCriticalSideEffectEdges(Function &Fn, DominatorTree *DT) {          // Okay, we have to split this edge.          SplitCriticalEdge(              Pred->getTerminator(), GetSuccessorNumber(Pred, &BB), -            CriticalEdgeSplittingOptions(DT).setMergeIdenticalEdges()); +            CriticalEdgeSplittingOptions(DT, LI).setMergeIdenticalEdges());          goto ReprocessBlock;        }    } @@ -406,10 +407,12 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {    ORE = make_unique<OptimizationRemarkEmitter>(&Fn);    auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>();    DominatorTree *DT = DTWP ? &DTWP->getDomTree() : nullptr; +  auto *LIWP = getAnalysisIfAvailable<LoopInfoWrapperPass>(); +  LoopInfo *LI = LIWP ? &LIWP->getLoopInfo() : nullptr;    DEBUG(dbgs() << "\n\n\n=== " << Fn.getName() << "\n"); -  SplitCriticalSideEffectEdges(const_cast<Function &>(Fn), DT); +  SplitCriticalSideEffectEdges(const_cast<Function &>(Fn), DT, LI);    CurDAG->init(*MF, *ORE);    FuncInfo->set(Fn, *MF, CurDAG);  | 
