forked from OSchip/llvm-project
[LoopIdiomRecognize][Remarks] Track loop-strided store to/from blocks
Differential revision: https://reviews.llvm.org/D109929
This commit is contained in:
parent
65feb9f444
commit
4b19e7dfae
|
@ -1200,13 +1200,20 @@ bool LoopIdiomRecognize::processLoopStridedStore(
|
|||
<< "\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
|
||||
|
@ -1452,7 +1459,10 @@ bool LoopIdiomRecognize::processLoopStoreOfLoopLoad(
|
|||
<< ore::NV("NewFunction", NewCall->getCalledFunction())
|
||||
<< "() intrinsic from " << ore::NV("Inst", InstRemark)
|
||||
<< " instruction in " << ore::NV("Function", TheStore->getFunction())
|
||||
<< " function";
|
||||
<< " function"
|
||||
<< ore::setExtraArgs()
|
||||
<< ore::NV("FromBlock", TheStore->getParent()->getName())
|
||||
<< ore::NV("ToBlock", Preheader->getName());
|
||||
});
|
||||
|
||||
// Okay, a new call to memcpy/memmove has been formed. Zap the original store
|
||||
|
|
|
@ -1,12 +1,31 @@
|
|||
; 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"
|
||||
|
||||
; Check that everything still works when debuginfo is present, and that it is reasonably propagated.
|
||||
|
||||
; CHECK: remark: <stdin>:6:1: Formed a call to llvm.memcpy.p0i8.p0i8.i64() intrinsic from load and store instruction in test6_dest_align function
|
||||
; CHECK: remark: <stdin>:6:1: Formed a call to llvm.memcpy.p0i8.p0i8.i64() intrinsic from load and store instruction in test6_dest_align function{{$}}
|
||||
|
||||
; YAML: --- !Passed
|
||||
; YAML-NEXT: Pass: loop-idiom
|
||||
; YAML-NEXT: Name: ProcessLoopStoreOfLoopLoad
|
||||
; YAML-NEXT: DebugLoc: { File: '<stdin>', Line: 6, Column: 1 }
|
||||
; YAML-NEXT: Function: test6_dest_align
|
||||
; YAML-NEXT: Args:
|
||||
; YAML-NEXT: - String: 'Formed a call to '
|
||||
; YAML-NEXT: - NewFunction: llvm.memcpy.p0i8.p0i8.i64
|
||||
; YAML-NEXT: - String: '() intrinsic from '
|
||||
; YAML-NEXT: - Inst: load and store
|
||||
; YAML-NEXT: - String: ' instruction in '
|
||||
; YAML-NEXT: - Function: test6_dest_align
|
||||
; YAML-NEXT: DebugLoc: { File: '<stdin>', Line: 1, Column: 0 }
|
||||
; YAML-NEXT: - String: ' function'
|
||||
; YAML-NEXT: - FromBlock: for.body
|
||||
; YAML-NEXT: - ToBlock: bb.nph
|
||||
; YAML-NEXT: ...
|
||||
|
||||
define void @test6_dest_align(i32* noalias align 1 %Base, i32* noalias align 4 %Dest, i64 %Size) nounwind ssp {
|
||||
; CHECK-LABEL: @test6_dest_align(
|
||||
|
|
|
@ -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 @@ target triple = "x86_64-unknown-linux-gnu"
|
|||
; *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(
|
||||
|
|
Loading…
Reference in New Issue