[llvm] [VPlan] Port invalid cost remarks to VPlan. (PR #99322)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 28 04:55:31 PDT 2024
================
@@ -889,20 +890,18 @@ static void debugVectorizationMessage(const StringRef Prefix,
/// \p PassName is the name of the pass (e.g. can be AlwaysPrint). \p
/// RemarkName is the identifier for the remark. If \p I is passed it is an
/// instruction that prevents vectorization. Otherwise \p TheLoop is used for
-/// the location of the remark. \return the remark object that can be
-/// streamed to.
-static OptimizationRemarkAnalysis createLVAnalysis(const char *PassName,
- StringRef RemarkName, Loop *TheLoop, Instruction *I) {
- Value *CodeRegion = TheLoop->getHeader();
- DebugLoc DL = TheLoop->getStartLoc();
-
- if (I) {
- CodeRegion = I->getParent();
- // If there is no debug location attached to the instruction, revert back to
- // using the loop's.
- if (I->getDebugLoc())
- DL = I->getDebugLoc();
- }
+/// the location of the remark. If \p DL is passed, use it as debug location for
+/// the remark. \return the remark object that can be streamed to.
+static OptimizationRemarkAnalysis
+createLVAnalysis(const char *PassName, StringRef RemarkName, Loop *TheLoop,
+ Instruction *I, DebugLoc DL = {}) {
+ Value *CodeRegion = I ? I->getParent() : TheLoop->getHeader();
+ // If debug location is attached to the instruction, use it. Otherwise if DL
+ // was not provided, use the loop's.
+ if (I && I->getDebugLoc())
+ DL = I->getDebugLoc();
+ else if (!DL)
+ DL = TheLoop->getStartLoc();
----------------
ayalz wrote:
(post commit): slight discrepancy with documentation above, should this instead read
```
// If debug location is provided, use it. Otherwise if debug location is attached to the instruction, use it.
// Otherwise use the start location of the loop.
if (!DL)
DL = (I && I->getDebugLoc()) ? I->getDebugLoc() : TheLoop->getStartLoc();
```
https://github.com/llvm/llvm-project/pull/99322
More information about the llvm-commits
mailing list