Skip to content

Commit cd05702

Browse files
Vidush Singhalvidsinghal
authored andcommitted
[Attributor]: Change allocation size and load/store offsets using AAPointerInfo for Alloca instructions
1 parent e862077 commit cd05702

File tree

15 files changed

+645
-133
lines changed

15 files changed

+645
-133
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5814,8 +5814,10 @@ struct AANonConvergent : public StateWrapper<BooleanState, AbstractAttribute> {
58145814

58155815
/// An abstract interface for struct information.
58165816
struct AAPointerInfo : public AbstractAttribute {
5817+
protected:
58175818
AAPointerInfo(const IRPosition &IRP) : AbstractAttribute(IRP) {}
58185819

5820+
public:
58195821
/// See AbstractAttribute::isValidIRPositionForInit
58205822
static bool isValidIRPositionForInit(Attributor &A, const IRPosition &IRP) {
58215823
if (!IRP.getAssociatedType()->isPtrOrPtrVectorTy())
@@ -6368,6 +6370,9 @@ struct AAPointerInfo : public AbstractAttribute {
63686370
virtual int64_t numOffsetBins() const = 0;
63696371
virtual bool reachesReturn() const = 0;
63706372
virtual void addReturnedOffsetsTo(OffsetInfo &) const = 0;
6373+
virtual void dumpState(raw_ostream &O) const = 0;
6374+
virtual const Access &getBinAccess(unsigned Index) const = 0;
6375+
virtual const DenseMap<Value *, OffsetInfo> &getOffsetInfoMap() const = 0;
63716376

63726377
/// Call \p CB on all accesses that might interfere with \p Range and return
63736378
/// true if all such accesses were known and the callback returned true for
@@ -6622,6 +6627,9 @@ struct AAAllocationInfo : public StateWrapper<BooleanState, AbstractAttribute> {
66226627

66236628
virtual std::optional<TypeSize> getAllocatedSize() const = 0;
66246629

6630+
using NewOffsetsTy = DenseMap<AA::RangeTy, AA::RangeTy>;
6631+
virtual const NewOffsetsTy &getNewOffsets() const = 0;
6632+
66256633
/// See AbstractAttribute::getName()
66266634
StringRef getName() const override { return "AAAllocationInfo"; }
66276635

0 commit comments

Comments
 (0)