Files
llvm-project/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
Adel Ejjeh 52539231c7 [NFC][LoopUtils] Add Loop::addStringLoopAttribute and Loop::addIntLoopAttribute (#194676)
Consolidate repeated `makePostTransformationMetadata` boilerplate into
two new `Loop` methods:
- `addStringLoopAttribute`: adds a string-only metadata attribute
- `addIntLoopAttribute`: adds a `{Name, ConstantInt(Value)}` metadata
attribute

Both accept optional `RemovePrefixes` to strip existing attributes
first.

Refactored call sites:
- `Loop::setLoopAlreadyUnrolled` (LoopInfo.cpp)
- `Loop::setLoopMustProgress` (LoopInfo.cpp)
- `postUnswitch` partial/injection (SimpleLoopUnswitch.cpp)
- `LoopVectorizeHints::setAlreadyVectorized`
(LoopVectorizationLegality.cpp)

This consolidation was requested by reviewers of #190258.

This patch was generated with assistance of GitHub Copilot/Claude Opus
and reviewed by a human.
2026-04-28 13:12:18 -05:00

155 KiB