Skip to content

Commit 7fdf356

Browse files
committed
[Attributor][NFCI] Move MemIntrinsic handling into the initializer
The handling for MemIntrinsic is not dependent on optimistic information, no need to put it in update for now. Added a TODO though.
1 parent f89deef commit 7fdf356

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,13 +1516,15 @@ struct AAPointerInfoCallSiteArgument final : AAPointerInfoFloating {
15161516
AAPointerInfoCallSiteArgument(const IRPosition &IRP, Attributor &A)
15171517
: AAPointerInfoFloating(IRP, A) {}
15181518

1519-
/// See AbstractAttribute::updateImpl(...).
1520-
ChangeStatus updateImpl(Attributor &A) override {
1521-
using namespace AA::PointerInfo;
1519+
/// See AbstractAttribute::initialize(...).
1520+
void initialize(Attributor &A) override {
1521+
AAPointerInfoFloating::initialize(A);
1522+
15221523
// We handle memory intrinsics explicitly, at least the first (=
15231524
// destination) and second (=source) arguments as we know how they are
15241525
// accessed.
15251526
if (auto *MI = dyn_cast_or_null<MemIntrinsic>(getCtxI())) {
1527+
// TODO: Simplify the length.
15261528
ConstantInt *Length = dyn_cast<ConstantInt>(MI->getLength());
15271529
int64_t LengthVal = AA::OffsetAndSize::Unknown;
15281530
if (Length)
@@ -1539,16 +1541,22 @@ struct AAPointerInfoCallSiteArgument final : AAPointerInfoFloating {
15391541
} else {
15401542
LLVM_DEBUG(dbgs() << "[AAPointerInfo] Unhandled memory intrinsic "
15411543
<< *MI << "\n");
1542-
return indicatePessimisticFixpoint();
1544+
indicatePessimisticFixpoint();
15431545
}
15441546

1547+
indicateOptimisticFixpoint();
1548+
15451549
LLVM_DEBUG({
1546-
dbgs() << "Accesses by bin after update:\n";
1550+
dbgs() << "Accesses by bin after initialization:\n";
15471551
dumpState(dbgs());
15481552
});
1549-
1550-
return Changed;
1553+
return;
15511554
}
1555+
}
1556+
1557+
/// See AbstractAttribute::updateImpl(...).
1558+
ChangeStatus updateImpl(Attributor &A) override {
1559+
using namespace AA::PointerInfo;
15521560

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

0 commit comments

Comments
 (0)