[PATCH] D74888: [Attributor] Use knowledge retained in llvm.assume (operand bundles)

Tyker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 23 09:41:53 PST 2020


Tyker added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:748-753
+  for (const Use &U : AssociatedValue.uses())
+    if (IntrinsicInst *II = dyn_cast_or_null<IntrinsicInst>(U.getUser()))
+      if (II->getIntrinsicID() == Intrinsic::assume && !II->isArgOperand(&U))
+        if (hasAttributeInAssume(*II, &AssociatedValue, AttrName, ArgValPtr))
+          if (!ArgValPtr || ArgVal > 0)
+            AssumeAttrMap[II] = Attribute::get(Ctx, AK, ArgVal);
----------------
jdoerfert wrote:
> uenoku wrote:
> > Can't we share `AssumeAttrMap` with other AAs whose associated values are the same?
> Yes, that is the plan. In KnowledgeRetention.{h/cpp} there is a TODO that says we should provide an API to get all information from an `llvm.assume` in a map. Once that is in place, the Attributor should be the one doing the querying (once) and then caching the information. Does that make sense?
> 
> I hoped @Tyker will look into that API at some point.
I added a revision (D75020) with what i thought about when talking about the map API. I hope it fits with what you had in mind.

but from looking at the code it seems like what could be the most usefull is a way to get from a use in the operand bundles to the knowledge associated with it quickly. and it can be done much quicker than hasAttributeInAssume and may be generally useful.

also sorry for the bug in hasAttributeInAssume.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74888/new/

https://reviews.llvm.org/D74888





More information about the llvm-commits mailing list