[PATCH] D157068: [Attributor] New attribute to identify what byte ranges are alive for an allocation

Vidhush Singhal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 15 13:02:32 PDT 2023


vidsinghal created this revision.
vidsinghal added a reviewer: jdoerfert.
Herald added subscribers: hoy, ormris, okura, kuter, hiraditya.
Herald added a project: All.
jdoerfert added a comment.
vidsinghal updated this revision to Diff 549154.
jdoerfert retitled this revision from "New attribute to identify what byte ranges are alive for an allocation" to "[Attributor] New attribute to identify what byte ranges are alive for an allocation".
jdoerfert added reviewers: tianshilei1992, jhuber6.
jdoerfert removed a project: All.
Herald added a reviewer: homerdin.
Herald added a project: All.
vidsinghal published this revision for review.
Herald added a reviewer: sstefan1.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

High level: Merge the test in one file. Use descriptive names for functions. remove the printf and other stuff that is not useful.


vidsinghal added a comment.

[Attributor] Revision for AAAllocationInfo attribute based on Review



================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:12310
+  /// See AbstractAttribute::manifest(...).
+  ChangeStatus manifest(Attributor &A) override {
+    auto MakeChange = [&](Instruction &I) {
----------------
Manifest is only called if the state is valid at the end. It looks like you duplicate lots of checks here that should not be necessary.


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:12412-12417
+    auto *I = this->getIRPosition().getCtxI();
+    if (!I) {
+      LLVM_DEBUG(
+          dbgs() << "[AAAllocationInfo, manifest] Instruction not valid.\n");
+      return ChangeStatus::UNCHANGED;
+    }
----------------
Assertion, this should never be the case, right?


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:12419-12421
+    if (!MakeChange(*I)) {
+      return ChangeStatus::UNCHANGED;
+    }
----------------
The lambda is called only once, right? Why use a lambda at all?
Also, if the alloca cannot be changed, indicate a pessimistic fixpoint and give up.


New attribute to check for byte ranges that are potentially dead.

  Changes the size of allocations automatically.
  Currently, only implementing for the case when a single range from start of the allocation exists.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157068

Files:
  llvm/include/llvm/Transforms/IPO/Attributor.h
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp
  llvm/test/Transforms/Attributor/allocator.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157068.549154.patch
Type: text/x-patch
Size: 15757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230815/398af42d/attachment.bin>


More information about the llvm-commits mailing list