Skip to content

Commit 3c51442

Browse files
committed
[Attributor] Fix an issue that could potentially cause AccessList and 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.
1 parent cdd11d6 commit 3c51442

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/include/llvm/Transforms/IPO/Attributor.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5818,7 +5818,10 @@ struct AAPointerInfo : public AbstractAttribute {
58185818
static void set_difference(const RangeList &L, const RangeList &R,
58195819
RangeList &D) {
58205820
std::set_difference(L.begin(), L.end(), R.begin(), R.end(),
5821-
std::back_inserter(D), RangeTy::OffsetLessThan);
5821+
std::back_inserter(D),
5822+
[](const RangeTy &L, const RangeTy &R) {
5823+
return (L.Offset < R.Offset) || (L != R);
5824+
});
58225825
}
58235826

58245827
unsigned size() const { return Ranges.size(); }

0 commit comments

Comments
 (0)