[llvm] [DFAJumpThreading] Try harder to avoid cycles in paths. (PR #169151)
Hongyu Chen via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 22 01:05:42 PST 2025
================
@@ -815,7 +819,12 @@ struct AllSwitchPaths {
std::vector<ThreadingPath> TempList;
for (const ThreadingPath &Path : PathsToPhiDef) {
+ SmallPtrSet<BasicBlock *, 32> PathSet(Path.getPath().begin(),
+ Path.getPath().end());
for (const PathType &PathToSw : PathsToSwitchBB) {
+ if (any_of(llvm::drop_begin(PathToSw),
+ [&](const BasicBlock *BB) { return PathSet.contains(BB); }))
+ continue;
----------------
XChy wrote:
Is it necessary? IIUC, `VB` should record all the visited blocks before calculating `PathsToSwitchBB`, and `paths` don't consider these visited again.
https://github.com/llvm/llvm-project/pull/169151
More information about the llvm-commits
mailing list