[llvm] [HashRecognize] Track visited in ValueEvolution (PR #147812)

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 01:56:38 PDT 2025


pfusik wrote:

> > Instead of the Visited set, have a ToVisit set initialized with all the loop instructions, erase while visiting and at the end just check if the set is empty.
> 
> I tried it, and it's exactly equivalent, with minor regression to the elegance of the code (due to missing erase_range, SmallPtrSetImpl stuff), and same computational complexity. I've simplified the check at the end.

Okay. I wasn't sure what's simpler.
> 
> > Instead of a set, only track the number of instructions. This would work if the instructions are visited once - is that the case?
> 
> No, the instructions are visited trip-count times.

If that's exactly trip-count times per instructions, we could compare against the number multiplied by TC.

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


More information about the llvm-commits mailing list