[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 05:42:12 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:
Yep, I understand it now when debugging. We actually don't guarantee that there are no common blocks between `PathsToPhiDef` and `PathsToSwitchBB` by checking `VB`, as we have popped out all inserted elements in `VB` after `paths` call.
https://github.com/llvm/llvm-project/pull/169151
More information about the llvm-commits
mailing list