Determine whether instruction ‘To’ is reachable from ‘From’, without passing through any blocks in ExclusionSet, returning true if uncertain.
Perhaps you hit the “uncertain” case (note the “Potentially” in the function name). Perhaps you hit the limit of BBs this function considers (your cfg looks quite convoluted). Try running with -dom-tree-reachability-max-bbs-to-explore set to some higher number (default is 32).
It depends on what you are using for. llvm::isPotentiallyReachable() should only be used if a conservative result is OK (as you noticed it may return true in some cases when they aren’t reachable). The reason llvm::isPotentiallyReachable() exists is to avoid excessive compile-time
May I ask whether there is a function that can accurately determine whether there is path reachability between two Basicblocks based on the function CFG? If not, I will consider implementing such a function myself.