[PATCH] D109929: [LoopIdiomRecognize][Remarks] Track loop-strided store to/from blocks
Jon Roelofs via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 16 14:36:13 PDT 2021
jroelofs created this revision.
jroelofs added a reviewer: anemet.
Herald added a subscriber: hiraditya.
jroelofs requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D109929
Files:
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll
Index: llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll
===================================================================
--- llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll
+++ llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -basic-aa -debugify -loop-idiom -pass-remarks=loop-idiom -pass-remarks-analysis=loop-idiom -verify -verify-each -verify-dom-info -verify-loop-info < %s -S 2>&1 | FileCheck %s
+; RUN: opt -basic-aa -debugify -loop-idiom -pass-remarks=loop-idiom -pass-remarks-analysis=loop-idiom -pass-remarks-output=%t.yaml -verify -verify-each -verify-dom-info -verify-loop-info < %s -S 2>&1 | FileCheck %s
+; RUN: FileCheck --input-file=%t.yaml %s --check-prefixes=YAML
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@@ -11,7 +12,23 @@
; *begin = value;
; }
-; CHECK: remark: <stdin>:4:1: Transformed loop-strided store in _Z15my_basic_memsetPcS_c function into a call to llvm.memset.p0i8.i64() intrinsic
+; CHECK: remark: <stdin>:4:1: Transformed loop-strided store in _Z15my_basic_memsetPcS_c function into a call to llvm.memset.p0i8.i64() intrinsic{{$}}
+
+; YAML: --- !Passed
+; YAML-NEXT: Pass: loop-idiom
+; YAML-NEXT: Name: ProcessLoopStridedStore
+; YAML-NEXT: DebugLoc: { File: '<stdin>', Line: 4, Column: 1 }
+; YAML-NEXT: Function: _Z15my_basic_memsetPcS_c
+; YAML-NEXT: Args:
+; YAML-NEXT: - String: 'Transformed loop-strided store in '
+; YAML-NEXT: - Function: _Z15my_basic_memsetPcS_c
+; YAML-NEXT: DebugLoc: { File: '<stdin>', Line: 1, Column: 0 }
+; YAML-NEXT: - String: ' function into a call to '
+; YAML-NEXT: - NewFunction: llvm.memset.p0i8.i64
+; YAML-NEXT: - String: '() intrinsic'
+; YAML-NEXT: - FromBlock: for.body
+; YAML-NEXT: - ToBlock: for.body.preheader
+; YAML-NEXT: ...
define void @_Z15my_basic_memsetPcS_c(i8* %ptr, i8* %end, i8 %value) {
; CHECK-LABEL: @_Z15my_basic_memsetPcS_c(
Index: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -1200,13 +1200,20 @@
<< "\n");
ORE.emit([&]() {
- return OptimizationRemark(DEBUG_TYPE, "ProcessLoopStridedStore",
- NewCall->getDebugLoc(), Preheader)
- << "Transformed loop-strided store in "
- << ore::NV("Function", TheStore->getFunction())
- << " function into a call to "
- << ore::NV("NewFunction", NewCall->getCalledFunction())
- << "() intrinsic";
+ OptimizationRemark R(DEBUG_TYPE, "ProcessLoopStridedStore",
+ NewCall->getDebugLoc(), Preheader);
+ R << "Transformed loop-strided store in "
+ << ore::NV("Function", TheStore->getFunction())
+ << " function into a call to "
+ << ore::NV("NewFunction", NewCall->getCalledFunction())
+ << "() intrinsic";
+ if (!Stores.empty())
+ R << ore::setExtraArgs();
+ for (auto *I : Stores) {
+ R << ore::NV("FromBlock", I->getParent()->getName())
+ << ore::NV("ToBlock", Preheader->getName());
+ }
+ return R;
});
// Okay, the memset has been formed. Zap the original store and anything that
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109929.373077.patch
Type: text/x-patch
Size: 3525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210916/cc3d514b/attachment.bin>
More information about the llvm-commits
mailing list