-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[DSE] Update dereferenceable attributes when adjusting memintrinsic ptr #125073
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
Changes from 2 commits
6b014c5
f6f7025
8b8ce48
0b58bf4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -563,6 +563,22 @@ static void shortenAssignment(Instruction *Inst, Value *OriginalDest, | |
| for_each(LinkedDVRAssigns, InsertAssignForOverlap); | ||
| } | ||
|
|
||
| // Helper to trim or drop any dereferencable/dereferencable_or_null attributes | ||
| // for a given argument, based on the new access being restricted to derefence | ||
dtcxzyw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // bytes in the range [Offset, Offset+Size). | ||
| static void trimDereferencableAttrs(AnyMemIntrinsic *Intrinsic, unsigned Arg, | ||
dtcxzyw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| uint64_t Offset, uint64_t Size) { | ||
| uint64_t End = Offset + Size; | ||
| if (Intrinsic->getParamDereferenceableBytes(Arg) >= End) | ||
| Intrinsic->addDereferenceableParamAttr(Arg, Size); | ||
|
||
| else | ||
| Intrinsic->removeParamAttr(Arg, Attribute::Dereferenceable); | ||
| if (Intrinsic->getParamDereferenceableOrNullBytes(Arg) >= End) | ||
| Intrinsic->addDereferenceableOrNullParamAttr(Arg, Size); | ||
| else | ||
| Intrinsic->removeParamAttr(Arg, Attribute::DereferenceableOrNull); | ||
| } | ||
|
|
||
| static bool tryToShorten(Instruction *DeadI, int64_t &DeadStart, | ||
| uint64_t &DeadSize, int64_t KillingStart, | ||
| uint64_t KillingSize, bool IsOverwriteEnd) { | ||
|
|
@@ -644,6 +660,7 @@ static bool tryToShorten(Instruction *DeadI, int64_t &DeadStart, | |
| DeadI->getIterator()); | ||
| NewDestGEP->setDebugLoc(DeadIntrinsic->getDebugLoc()); | ||
| DeadIntrinsic->setDest(NewDestGEP); | ||
| trimDereferencableAttrs(DeadIntrinsic, 0, ToRemoveSize, NewSize); | ||
| } | ||
|
|
||
| // Update attached dbg.assign intrinsics. Assume 8-bit byte. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.