[MLIR] LoopAnnotationAttr should not require FusedLoc for startLoc/endLoc
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
LoopAnnotationAttr hardcodes its startLoc and endLoc parameters as FusedLoc. This forces LoopAnnotationImporter.cpp to include a toFusedLoc shim that dismantles a DILocAttr and re-encodes it as FusedLoc::get({sourceLoc}, scope) just to satisfy the type constraint. This reintroduces the convention-based FusedLoc encoding that DILocAttr was designed to replace.
The startLoc/endLoc parameters should accept a general Location (or at minimum also accept DILocAttr), so that translateLoc-produced locations can be stored directly without an unnecessary re-encoding through FusedLoc. This would also remove the need for the toFusedLoc workaround and align LoopAnnotationAttr with the DILocAttr direction taken everywhere else.
Followup for: https://github.com/llvm/llvm-project/pull/186146
Contributor guide
Research direction
Start in LoopAnnotationImporter.cpp, then locate the LoopAnnotationAttr definition and inspect how startLoc and endLoc are typed and constructed. Trace the toFusedLoc shim and translateLoc-produced locations; done means the workaround is no longer needed and direct compatible locations can be stored without re-encoding through FusedLoc.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100