[PATCH] D97065: [dfsan] Add origin address calculation
stephan.yichao.zhao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 19 11:04:05 PST 2021
stephan.yichao.zhao added inline comments.
================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1554
+ OriginLong = IRB.CreateAnd(OriginLong, ConstantInt::get(IntptrTy, ~Mask));
+ }
+ OriginPtr = IRB.CreateIntToPtr(OriginLong, OriginPtrTy);
----------------
morehouse wrote:
> We can avoid this AND operation entirely by including it in the shadow mask.
Yeah. ~0x700...0003 works. It seems that the problem is we wanted to get both shadow and origin addresses. So
1) with the current approach,
offset = addr & ~0x700...00
shadow = offset x 2
origin = offset + origin_base
// When align is < 4, we may need one more origin & 4
2) if we use ~0x700...03
offset_s = addr & ~0x700...00
shadow = offset_s x 2
offset_o = addr & ~0x700...03
origin = offset_o + origin_base
So the case 1 actually uses 1 less IR instruction in most cases.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97065/new/
https://reviews.llvm.org/D97065
More information about the llvm-commits
mailing list