[PATCH] D92629: [dfsan] Add empty APIs for field-level shadow
Matt Morehouse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 4 08:15:23 PST 2020
morehouse 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.
----------------
This function looks unused by anything except the other `getZeroShadow`. Can we remove it?
================
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.
----------------
Maybe we don't need this function either?
================
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) {
----------------
Is this equivalent to `getShadowTy(S)`? If so, we can save a line of code by doing that instead.
================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1957
void DFSanVisitor::visitPHINode(PHINode &PN) {
- PHINode *ShadowPN = PHINode::Create(DFSF.DFS.PrimitiveShadowTy,
- PN.getNumIncomingValues(), "", &PN);
+ Type *ShadowTy = DFSF.DFS.getShadowTy(PN.getType());
+ PHINode *ShadowPN =
----------------
Let's make use of the overloaded `getShadowTy` to do `getShadowTy(PN)` instead.
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