diff options
author | Mircea Trofin <mtrofin@google.com> | 2018-02-10 00:07:45 +0000 |
---|---|---|
committer | Mircea Trofin <mtrofin@google.com> | 2018-02-10 00:07:45 +0000 |
commit | 73b96d6dcf15a511bb0d2bfb14a7c18be487b2b0 (patch) | |
tree | 042c7f96c3c026f79e66fc49050eeaa2f9ffa287 /llvm/lib/Transforms/Vectorize | |
parent | 2a639858be9098e56708a22ba84cde1f0bf0b195 (diff) | |
download | bcm5719-llvm-73b96d6dcf15a511bb0d2bfb14a7c18be487b2b0.tar.gz bcm5719-llvm-73b96d6dcf15a511bb0d2bfb14a7c18be487b2b0.zip |
[LV] Fix analyzeInterleaving when -pass-remarks enabled
Summary:
If -pass-remarks=loop-vectorize, atomic ops will be seen by
analyzeInterleaving(), even though canVectorizeMemory() == false. This
is because we are requesting extra analysis instead of bailing out.
In such a case, we end up with a Group in both Load- and StoreGroups,
and then we'll try to access freed memory when traversing LoadGroups after having had released the Group when iterating over StoreGroups.
The fix is to include mayWriteToMemory() when validating that two
instructions are the same kind of memory operation.
Reviewers: mssimpso, davidxl
Reviewed By: davidxl
Subscribers: hsaito, fhahn, llvm-commits
Differential Revision: https://reviews.llvm.org/D43064
llvm-svn: 324786
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 973617cc0c7..7f45c7a3571 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -5926,7 +5926,12 @@ void InterleavedAccessInfo::analyzeInterleaving( // Ignore A if it's already in a group or isn't the same kind of memory // operation as B. - if (isInterleaved(A) || A->mayReadFromMemory() != B->mayReadFromMemory()) + // Note that mayReadFromMemory() isn't mutually exclusive to mayWriteToMemory + // in the case of atomic loads. We shouldn't see those here, canVectorizeMemory() + // should have returned false - except for the case we asked for optimization + // remarks. + if (isInterleaved(A) || (A->mayReadFromMemory() != B->mayReadFromMemory()) + || (A->mayWriteToMemory() != B->mayWriteToMemory())) continue; // Check rules 1 and 2. Ignore A if its stride or size is different from |