Skip to content

Commit bb63739

Browse files
committed
[test][HWASAN] Precommit -hwasan-inline-fast-path-checks tests
Reviewed By: fmayer Differential Revision: https://reviews.llvm.org/D159157
1 parent 3e0bc8c commit bb63739

File tree

4 files changed

+1033
-2
lines changed

4 files changed

+1033
-2
lines changed

llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ static cl::opt<bool> ClInlineAllChecks("hwasan-inline-all-checks",
222222
cl::desc("inline all checks"),
223223
cl::Hidden, cl::init(false));
224224

225+
static cl::opt<bool> ClInlineFastPathChecks("hwasan-inline-fast-path-checks",
226+
cl::desc("inline all checks"),
227+
cl::Hidden, cl::init(false));
228+
225229
// Enabled from clang by "-fsanitize-hwaddress-experimental-aliasing".
226230
static cl::opt<bool> ClUsePageAliases("hwasan-experimental-use-page-aliases",
227231
cl::desc("Use page aliasing in HWASan"),
@@ -372,6 +376,7 @@ class HWAddressSanitizer {
372376
bool CompileKernel;
373377
bool Recover;
374378
bool OutlinedChecks;
379+
bool InlineFastPath;
375380
bool UseShortGranules;
376381
bool InstrumentLandingPads;
377382
bool InstrumentWithCalls;
@@ -579,6 +584,13 @@ void HWAddressSanitizer::initializeModule() {
579584
TargetTriple.isOSBinFormatELF() &&
580585
(ClInlineAllChecks.getNumOccurrences() ? !ClInlineAllChecks : !Recover);
581586

587+
InlineFastPath =
588+
(ClInlineFastPathChecks.getNumOccurrences()
589+
? ClInlineFastPathChecks
590+
: !(TargetTriple.isAndroid() ||
591+
TargetTriple.isOSFuchsia())); // These platforms may prefer less
592+
// inlining to reduce binary size.
593+
582594
if (ClMatchAllTag.getNumOccurrences()) {
583595
if (ClMatchAllTag != -1) {
584596
MatchAllTag = ClMatchAllTag & 0xFF;
@@ -845,6 +857,11 @@ void HWAddressSanitizer::instrumentMemAccessOutline(Value *Ptr, bool IsWrite,
845857
assert(!UsePageAliases);
846858
const int64_t AccessInfo = getAccessInfo(IsWrite, AccessSizeIndex);
847859
IRBuilder<> IRB(InsertBefore);
860+
861+
if (InlineFastPath) {
862+
// TODO.
863+
}
864+
848865
Module *M = IRB.GetInsertBlock()->getParent()->getParent();
849866
Ptr = IRB.CreateBitCast(Ptr, Int8PtrTy);
850867
IRB.CreateCall(Intrinsic::getDeclaration(

0 commit comments

Comments
 (0)