[llvm] [HashRecognize] Fix the analysis result (PR #144742)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 18 09:38:25 PDT 2025


artagnon wrote:

> Have you considered going the other way around and not making this a PM-level analysis at all? You can just locally instantiate the object in the single place you're going to use it. I don't think you gain anything but unwelcome problems (like: did the results potentially get invalidated by a LIR transform that ran earlier?)

I thought about that, yes. I did lean towards making it a PM-level analysis for ease of testing. I leverage the existing infrastructure in update_analyze_test_checks to auto-generate the result, with a simple opt invocation in the RUN line. If this weren't a PM-level analysis, I'd have to hand-craft unit-tests in C++.

I think the specific problem you mentioned can be easily tackled by not preserving the analysis result in LIR. I don't think LIR runs more than once anyway, so I don't think it's ever computed more than once.

Besides, I plan to grow HashRecognize in size by also including other polynomial hashes, and possibly requiring more analysis results. In that sense, I think it is less like ConstraintSystem, and more like an independent analysis.

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


More information about the llvm-commits mailing list