aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index ddee6a0..b32047f 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -5926,7 +5926,6 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
Updates.push_back({DominatorTree::Delete, BB, SI->getDefaultDest()});
}
- bool ReturnedEarly = false;
for (PHINode *PHI : PHIs) {
const ResultListTy &ResultList = ResultLists[PHI];
@@ -5938,15 +5937,6 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
Value *Result = Table.BuildLookup(TableIndex, Builder);
- // If the result is used to return immediately from the function, we want to
- // do that right here.
- if (PHI->hasOneUse() && isa<ReturnInst>(*PHI->user_begin()) &&
- PHI->user_back() == CommonDest->getFirstNonPHIOrDbg()) {
- Builder.CreateRet(Result);
- ReturnedEarly = true;
- break;
- }
-
// Do a small peephole optimization: re-use the switch table compare if
// possible.
if (!TableHasHoles && HasDefaultResults && RangeCheckBranch) {
@@ -5960,11 +5950,9 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
PHI->addIncoming(Result, LookupBB);
}
- if (!ReturnedEarly) {
- Builder.CreateBr(CommonDest);
- if (DTU)
- Updates.push_back({DominatorTree::Insert, LookupBB, CommonDest});
- }
+ Builder.CreateBr(CommonDest);
+ if (DTU)
+ Updates.push_back({DominatorTree::Insert, LookupBB, CommonDest});
// Remove the switch.
SmallPtrSet<BasicBlock *, 8> RemovedSuccessors;