[llvm] [PGO] Add llvm.loop.estimated_trip_count metadata (PR #152775)

Joel E. Denny via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 13:15:20 PDT 2025


================
@@ -7966,6 +7966,54 @@ The attributes in this metadata are added to all followup loops of the
 loop distribution pass. See
 :ref:`Transformation Metadata <transformation-metadata>` for details.
 
+'``llvm.loop.estimated_trip_count``' Metadata
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This metadata records an estimated trip count for the loop.  The first operand
+is the string ``llvm.loop.estimated_trip_count``.  The second operand is an
+integer constant of type ``i32`` or smaller specifying the estimate.  For
----------------
jdenny-ornl wrote:

I set a maximum when I realized the current implementation cannot handle anything wider.  For flexibility, I did not set a minimum, but I have no specific use case in mind.  Do you prefer i32 only?  I think that would be fine for me.

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


More information about the llvm-commits mailing list