[PATCH] D118947: [nfc] [hwasan] factor out logic to collect info about stack

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 10 14:40:40 PST 2022


eugenis added inline comments.


================
Comment at: llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h:75
 
+struct AllocaInfo {
+  AllocaInst *AI;
----------------
Let us not be the first to define "AllocaInfo" in namespace llvm. There are already two others but fortunately they are wrapped in an anonymous namespace. StackInfo is very generic, too.

Maybe call it StackTaggingInfo or StackInstrumentationInfo and make AllocaInfo its inner class?
Or move everything to namespace memtag or something.





================
Comment at: llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h:84
+  SmallVector<Instruction *, 4> UnrecognizedLifetimes;
+  DenseMap<AllocaInst *, std::vector<DbgVariableIntrinsic *>> AllocaDbgMap;
+  SmallVector<Instruction *, 8> RetVec;
----------------
This can be part of AllocaInfo (not necessarily in this change). We also do not need to collect these for uninteresting allocas I think.


================
Comment at: llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h:104
+  StackInfo Info;
+  StackInfoBuilderDelegate *Delegate;
+};
----------------
Can we just pass an std::function? This delegate stuff feels very heavy handed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118947



More information about the llvm-commits mailing list