Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
Fix a bug in the loop in JumpThreading::ProcessThreadableEdges() wher…
Browse files Browse the repository at this point in the history
…e it could falsely produce a MultipleDestSentinel value if the first predecessor ended with an 'indirectbr'. If that happened, it caused an unnecessary FindMostPopularDest() call.

This wasn't a correctness problem, but it broke the fast path for single-predecessor blocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121966 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
fvbommel committed Dec 16, 2010
1 parent ebef48e commit 01abcf3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Transforms/Scalar/JumpThreading.cpp
Expand Up @@ -984,7 +984,7 @@ FindMostPopularDest(BasicBlock *BB,
}
}

// Okay, now we know the most popular destination. If there is more than
// Okay, now we know the most popular destination. If there is more than one
// destination, we need to determine one. This is arbitrary, but we need
// to make a deterministic decision. Pick the first one that appears in the
// successor list.
Expand Down Expand Up @@ -1064,7 +1064,7 @@ bool JumpThreading::ProcessThreadableEdges(Value *Cond, BasicBlock *BB,
}

// If we have exactly one destination, remember it for efficiency below.
if (i == 0)
if (PredToDestList.empty())
OnlyDest = DestBB;
else if (OnlyDest != DestBB)
OnlyDest = MultipleDestSentinel;
Expand Down

0 comments on commit 01abcf3

Please sign in to comment.