Skip to content

Commit

Permalink
[Attributor][NFCI] Move MemIntrinsic handling into the initializer
Browse files Browse the repository at this point in the history
The handling for MemIntrinsic is not dependent on optimistic
information, no need to put it in update for now. Added a TODO though.
  • Loading branch information
jdoerfert committed Nov 2, 2022
1 parent f89deef commit 7fdf356
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1516,13 +1516,15 @@ struct AAPointerInfoCallSiteArgument final : AAPointerInfoFloating {
AAPointerInfoCallSiteArgument(const IRPosition &IRP, Attributor &A)
: AAPointerInfoFloating(IRP, A) {}

/// See AbstractAttribute::updateImpl(...).
ChangeStatus updateImpl(Attributor &A) override {
using namespace AA::PointerInfo;
/// See AbstractAttribute::initialize(...).
void initialize(Attributor &A) override {
AAPointerInfoFloating::initialize(A);

// We handle memory intrinsics explicitly, at least the first (=
// destination) and second (=source) arguments as we know how they are
// accessed.
if (auto *MI = dyn_cast_or_null<MemIntrinsic>(getCtxI())) {
// TODO: Simplify the length.
ConstantInt *Length = dyn_cast<ConstantInt>(MI->getLength());
int64_t LengthVal = AA::OffsetAndSize::Unknown;
if (Length)
Expand All @@ -1539,16 +1541,22 @@ struct AAPointerInfoCallSiteArgument final : AAPointerInfoFloating {
} else {
LLVM_DEBUG(dbgs() << "[AAPointerInfo] Unhandled memory intrinsic "
<< *MI << "\n");
return indicatePessimisticFixpoint();
indicatePessimisticFixpoint();
}

indicateOptimisticFixpoint();

LLVM_DEBUG({
dbgs() << "Accesses by bin after update:\n";
dbgs() << "Accesses by bin after initialization:\n";
dumpState(dbgs());
});

return Changed;
return;
}
}

/// See AbstractAttribute::updateImpl(...).
ChangeStatus updateImpl(Attributor &A) override {
using namespace AA::PointerInfo;

// TODO: Once we have call site specific value information we can provide
// call site specific liveness information and then it makes
Expand Down

0 comments on commit 7fdf356

Please sign in to comment.