[flang-commits] [flang] [llvm] [LoopIdiom] Recognize naive popcount loop pattern (PR #172677)
Kang-Che Sung 宋岡哲 via flang-commits
flang-commits at lists.llvm.org
Mon Dec 22 00:29:53 PST 2025
Explorer09 wrote:
> I did use LLM for the summary as I wanted it to be descriptive.
Programmers can read code. If LLM repeats the information that can be inferred from the code itself, then the information is redundant and should be omitted.
The description of the commits should focus on _why_ you made the changes, not _how_ you did it. This information is seldom included if you use LLM for your commit descriptions. So you should review what LLM outputs and cut out redundant stuff.
> I am an beginner to open source contributions and was not sure also LLM makes up for my grammatical mistakes so i used it.
LLM correcting basic grammatical mistakes is okay.
> Regarding the naive popcounts, I am aware that there can be huge number of implementations, i intended to make LLVM recognize the specific implementation in issue #172193 rather than generalizing. However I would like suggestions on how this can be generalized.
Ideally all recognitions of popcount patterns should be centralized in one place in the optimizer. That can prevent _everyone_ wanting to implement their own popcount recognition adding their own functions everywhere in the optimizer, messing up the code.
As I commented in issue #172193, C and C++ have standard interfaces `stdc_count_ones` and `std::popcount` to do the thing, and future code should transition to those interfaces whenever possible instead of demanding the compiler to do the work.
https://github.com/llvm/llvm-project/pull/172677
More information about the flang-commits
mailing list