[llvm] [SimplifyCFG]: Switch on umin replaces default (PR #164097)

Hongyu Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 03:58:20 PDT 2025


================
@@ -4171,6 +4171,18 @@ SwitchInstProfUpdateWrapper::removeCase(SwitchInst::CaseIt I) {
   return SI.removeCase(I);
 }
 
+void SwitchInstProfUpdateWrapper::setDefaultDest(SwitchInst::CaseIt I) {
+  auto DestBlock = I->getCaseSuccessor();
+  if (Weights) {
+    auto Weight = getSuccessorWeight(I->getCaseIndex() + 1);
+    if (Weight.has_value()) {
----------------
XChy wrote:

`Weight` should be available if `Weights` is available. Remove the check or use an assertion here.

https://github.com/llvm/llvm-project/pull/164097


More information about the llvm-commits mailing list