aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorYingwei Zheng <dtcxzyw2333@gmail.com>2025-04-03 14:47:47 +0800
committerGitHub <noreply@github.com>2025-04-03 14:47:47 +0800
commitb6c0ce0bb67d822fac1e3b42461f66c261c1157c (patch)
treecb19a11893f4a43ecb1cbbf7676c262251c3144b /llvm/lib/Transforms/Utils/Local.cpp
parent3295970d846b0d820b863f9eeac559b80239297e (diff)
downloadllvm-b6c0ce0bb67d822fac1e3b42461f66c261c1157c.zip
llvm-b6c0ce0bb67d822fac1e3b42461f66c261c1157c.tar.gz
llvm-b6c0ce0bb67d822fac1e3b42461f66c261c1157c.tar.bz2
[IR][NFC] Use `SwitchInst::defaultDestUnreachable` (#134199)
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index edec0e7..2f3ea22 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -203,10 +203,8 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions,
BasicBlock *TheOnlyDest = DefaultDest;
// If the default is unreachable, ignore it when searching for TheOnlyDest.
- if (isa<UnreachableInst>(DefaultDest->getFirstNonPHIOrDbg()) &&
- SI->getNumCases() > 0) {
+ if (SI->defaultDestUnreachable() && SI->getNumCases() > 0)
TheOnlyDest = SI->case_begin()->getCaseSuccessor();
- }
bool Changed = false;