diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -1397,6 +1397,8 @@ // false negatives. The proper implementation requires cooperation with // the frontend. static bool isInterestingPointerComparison(Instruction *I) { + if (I->hasMetadata("nosanitize")) + return false; if (ICmpInst *Cmp = dyn_cast(I)) { if (!Cmp->isRelational()) return false; @@ -1411,6 +1413,8 @@ // false negatives. The proper implementation requires cooperation with // the frontend. static bool isInterestingPointerSubtraction(Instruction *I) { + if (I->hasMetadata("nosanitize")) + return false; if (BinaryOperator *BO = dyn_cast(I)) { if (BO->getOpcode() != Instruction::Sub) return false;