[PATCH] D140831: Fix a phase-ordering problem in SimplifyCFG.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 02:07:07 PST 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:241
+        // Removing this case may have made the condition constant.
+        CI = dyn_cast<ConstantInt>(SI->getCondition());
         Changed = true;
----------------
I think this may cause problems if we have the following case: We have a case 1 => foo, case 2 => default, then removing default folds CI to 1, but at this point we have already visited case 1, so TheOnlyDest will remain nullptr, and we'll set it to the default destination below, which would be the wrong one in that case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140831/new/

https://reviews.llvm.org/D140831



More information about the llvm-commits mailing list