[PATCH] D92629: [dfsan] Add empty APIs for field-level shadow

stephan.yichao.zhao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 4 12:31:00 PST 2020


stephan.yichao.zhao marked 2 inline comments as done.
stephan.yichao.zhao added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:425
+  /// primitive types, values or zero constants.
+  Constant *getZeroShadow(Type *OrigTy);
+  /// Returns a zero constant with the shadow type of V's type.
----------------
morehouse wrote:
> This function looks unused by anything except the other `getZeroShadow`.  Can we remove it?
This is a problem of the incremental diffs. In the next diff, this function is used. I removed it from this diff, and will be adding it back in the next one.


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:431
+  /// Returns the shadow type of OrigTy.
+  Type *getShadowTy(Type *OrigTy);
+  /// Returns the shadow type of of V's type.
----------------
morehouse wrote:
> Maybe we don't need this function either?
This one is the same. The next diff will be using it. 

We could remove it from this diff. But some APIs, like getArgTLS, already use it.

The version with Value* argument is like a help function to reduce "V->getType()".


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1684
       unsigned Size =
-          getDataLayout().getTypeAllocSize(DFSF.DFS.PrimitiveShadowTy);
+          getDataLayout().getTypeAllocSize(DFSF.DFS.getShadowTy(RT));
       if (Size <= kRetvalTLSSize) {
----------------
morehouse wrote:
> Is this equivalent to `getShadowTy(S)`?  If so, we can save a line of code by doing that instead.
S is a shadow value. it could be DFSF.DFS.getShadowTy(RI.getReturnValue()).
But RT is also used by DFSF.getRetvalTLS, so they share the same RT.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92629



More information about the llvm-commits mailing list