aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorYingwei Zheng <dtcxzyw2333@gmail.com>2024-02-13 17:28:06 +0800
committerGitHub <noreply@github.com>2024-02-13 17:28:06 +0800
commitca61e6a71dbe622593b27ab6c6f3bfd058069772 (patch)
treeb9055ce18707e177f18c7cba0c776d9e40eb4f3a /llvm/lib
parent44706bd4f0e26f86eda24e4888044897fd4f92a8 (diff)
downloadllvm-ca61e6a71dbe622593b27ab6c6f3bfd058069772.zip
llvm-ca61e6a71dbe622593b27ab6c6f3bfd058069772.tar.gz
llvm-ca61e6a71dbe622593b27ab6c6f3bfd058069772.tar.bz2
Revert "[CVP] Check whether the default case is reachable (#79993)" (#81585)
This reverts commit a034e65e972175a2465deacb8c78bc7efc99bd23. Some protobuf users reported that this patch caused a significant compile-time regression because `TailDuplicator` works poorly with a specific pattern. We will reland it once the codegen issue is fixed.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp34
1 files changed, 0 insertions, 34 deletions
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index 24e1677..9235850 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -371,7 +371,6 @@ static bool processSwitch(SwitchInst *I, LazyValueInfo *LVI,
{ // Scope for SwitchInstProfUpdateWrapper. It must not live during
// ConstantFoldTerminator() as the underlying SwitchInst can be changed.
SwitchInstProfUpdateWrapper SI(*I);
- unsigned ReachableCaseCount = 0;
for (auto CI = SI->case_begin(), CE = SI->case_end(); CI != CE;) {
ConstantInt *Case = CI->getCaseValue();
@@ -408,33 +407,6 @@ static bool processSwitch(SwitchInst *I, LazyValueInfo *LVI,
// Increment the case iterator since we didn't delete it.
++CI;
- ++ReachableCaseCount;
- }
-
- BasicBlock *DefaultDest = SI->getDefaultDest();
- if (ReachableCaseCount > 1 &&
- !isa<UnreachableInst>(DefaultDest->getFirstNonPHIOrDbg())) {
- ConstantRange CR = LVI->getConstantRangeAtUse(I->getOperandUse(0),
- /*UndefAllowed*/ false);
- // The default dest is unreachable if all cases are covered.
- if (!CR.isSizeLargerThan(ReachableCaseCount)) {
- BasicBlock *NewUnreachableBB =
- BasicBlock::Create(BB->getContext(), "default.unreachable",
- BB->getParent(), DefaultDest);
- new UnreachableInst(BB->getContext(), NewUnreachableBB);
-
- DefaultDest->removePredecessor(BB);
- SI->setDefaultDest(NewUnreachableBB);
-
- if (SuccessorsCount[DefaultDest] == 1)
- DTU.applyUpdatesPermissive(
- {{DominatorTree::Delete, BB, DefaultDest}});
- DTU.applyUpdatesPermissive(
- {{DominatorTree::Insert, BB, NewUnreachableBB}});
-
- ++NumDeadCases;
- Changed = true;
- }
}
}
@@ -1255,12 +1227,6 @@ CorrelatedValuePropagationPass::run(Function &F, FunctionAnalysisManager &AM) {
if (!Changed) {
PA = PreservedAnalyses::all();
} else {
-#if defined(EXPENSIVE_CHECKS)
- assert(DT->verify(DominatorTree::VerificationLevel::Full));
-#else
- assert(DT->verify(DominatorTree::VerificationLevel::Fast));
-#endif // EXPENSIVE_CHECKS
-
PA.preserve<DominatorTreeAnalysis>();
PA.preserve<LazyValueAnalysis>();
}