-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Attributor] Fix an issue that could potentially cause AccessList
and OffsetBins
out of sync
#106187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-backend-amdgpu @llvm/pr-subscribers-llvm-transforms Author: Shilei Tian (shiltian) ChangesThe implementation of I do have a reproducer but the reproducer itself is 248kb. Fix SWDEV-479757. Full diff: https://github.com/llvm/llvm-project/pull/106187.diff 1 Files Affected:
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 718cf704cbdf1a..e4e94ad40acb8d 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -5818,7 +5818,10 @@ struct AAPointerInfo : public AbstractAttribute {
static void set_difference(const RangeList &L, const RangeList &R,
RangeList &D) {
std::set_difference(L.begin(), L.end(), R.begin(), R.end(),
- std::back_inserter(D), RangeTy::OffsetLessThan);
+ std::back_inserter(D),
+ [](const RangeTy &L, const RangeTy &R) {
+ return (L.Offset < R.Offset) || (L != R);
+ });
}
unsigned size() const { return Ranges.size(); }
|
3c51442
to
cb98c62
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe the claim that llvm-reduce can't further reduce it. Can you post it
I added it in the description. |
Your reducer script runs all of clang, you should start reducing from the IR extracted before the failing pass and just run the one pass. When I do that, I get this:
|
@arsenm Aha! That is good to know. TIL. :-) |
cb98c62
to
1a23192
Compare
1a23192
to
ce4a9dd
Compare
llvm/test/CodeGen/AMDGPU/amdgpu-attributor-accesslist-offsetbins-out-of-sync.ll
Outdated
Show resolved
Hide resolved
llvm/test/CodeGen/AMDGPU/amdgpu-attributor-accesslist-offsetbins-out-of-sync.ll
Outdated
Show resolved
Hide resolved
ce4a9dd
to
5090341
Compare
llvm/test/CodeGen/AMDGPU/amdgpu-attributor-accesslist-offsetbins-out-of-sync.ll
Outdated
Show resolved
Hide resolved
5090341
to
3d01afb
Compare
…nd `OffsetBins` out of sync The implementation of `AAPointerInfo::RangeList::set_difference` doesn't consider the case where two ranges have the same offset but different sizes. This could causes `AccessList` and `OffsetBins` out of sync because a range has been already updated in `AccessList` but missing in `ToRemove`. I do have a reproducer but the reproducer itself is 248kb. `llvm-reduce` can't further reduce it. Not sure how I can make a smaller reproducer. Fix SWDEV-479757.
3d01afb
to
6793303
Compare
The implementation of
AAPointerInfo::RangeList::set_difference
doesn'tconsider the case where two ranges have the same offset but different sizes.
This could cause
AccessList
andOffsetBins
out of sync because a range hasbeen already updated in
AccessList
but missing inToRemove
.I do have a reproducer but the reproducer itself is 248kb.
llvm-reduce
can'tfurther reduce it. Not sure how I can make a smaller reproducer.
Fixes: SWDEV-479757.