[llvm] [FunctionAttrs] Add the "initializes" attribute inference (PR #97373)

Jan Voung via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 10:49:25 PDT 2024


================
@@ -580,6 +582,205 @@ struct ArgumentUsesTracker : public CaptureTracker {
   const SCCNodeSet &SCCNodes;
 };
 
+struct ArgumentUse {
+  Use *U;
+  std::optional<int64_t> Offset;
+};
+
+// A struct of argument access info. "Unknown" accesses are the cases like
+// unrecognized instructions, instructions that have more than one use of
+// the argument, or volatile memory accesses. "Unknown" implies "IsClobber"
+// and an empty access range.
+// Write or Read accesses can be clobbers as well for example, a Load with
+// scalable type.
+struct ArgumentAccessInfo {
+  enum AccessType { Write, Read, Unknown };
+  AccessType ArgAccessType;
+  ConstantRangeList AccessRanges;
+  bool IsClobber = false;
+};
+
+struct UsesPerBlockInfo {
+  DenseMap<Instruction *, ArgumentAccessInfo> Insts;
----------------
jvoung wrote:

If it's <= 2, and a non-trivial amount are == 2, you may want to provide 3 inline buckets to avoid having to grow() when the 2nd entry is inserted.
There's a max load factor of 3/4 https://github.com/llvm/llvm-project/blob/c1f1aab5d5d4d2a9d86e9e3e1794d609749a15f0/llvm/include/llvm/ADT/DenseMap.h#L612 so I think it won't allow filling 2 inline buckets with 2 entries.



https://github.com/llvm/llvm-project/pull/97373


More information about the llvm-commits mailing list