mirror of
https://github.com/intel/llvm.git
synced 2026-02-06 06:31:50 +08:00
Emit remark about aliasing pointers
llvm-svn: 252847
This commit is contained in:
@@ -2381,6 +2381,7 @@ bool Scop::buildAliasGroups(AliasAnalysis &AA) {
|
||||
isl_set_free(AGDomain);
|
||||
}
|
||||
|
||||
auto &F = *getRegion().getEntry()->getParent();
|
||||
MapVector<const Value *, SmallPtrSet<MemoryAccess *, 8>> ReadOnlyPairs;
|
||||
SmallPtrSet<const Value *, 4> NonReadOnlyBaseValues;
|
||||
for (AliasGroupTy &AG : AliasGroups) {
|
||||
@@ -2393,6 +2394,11 @@ bool Scop::buildAliasGroups(AliasAnalysis &AA) {
|
||||
}
|
||||
|
||||
for (auto II = AG.begin(); II != AG.end();) {
|
||||
emitOptimizationRemarkAnalysis(
|
||||
F.getContext(), DEBUG_TYPE, F,
|
||||
(*II)->getAccessInstruction()->getDebugLoc(),
|
||||
"Possibly aliasing pointer, use restrict keyword.");
|
||||
|
||||
Value *BaseAddr = (*II)->getBaseAddr();
|
||||
if (HasWriteAccess.count(BaseAddr)) {
|
||||
NonReadOnlyBaseValues.insert(BaseAddr);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
; RUN: opt %loadPolly -pass-remarks-analysis="polly-scops" -polly-scops < %s 2>&1| FileCheck %s
|
||||
;
|
||||
; CHECK: remark: test/ScopInfo/remarks.c:4:7: SCoP begins here.
|
||||
; CHECK: remark: test/ScopInfo/remarks.c:9:18: Possibly aliasing pointer, use restrict keyword.
|
||||
; CHECK: remark: test/ScopInfo/remarks.c:9:33: Possibly aliasing pointer, use restrict keyword.
|
||||
; CHECK: remark: test/ScopInfo/remarks.c:9:15: Possibly aliasing pointer, use restrict keyword.
|
||||
; CHECK: remark: test/ScopInfo/remarks.c:14:3: SCoP ends here.
|
||||
; CHECK: remark: test/ScopInfo/remarks.c:19:3: SCoP begins here.
|
||||
; CHECK: remark: test/ScopInfo/remarks.c:22:16: SCoP ends here but was dismissed.
|
||||
|
||||
Reference in New Issue
Block a user