[llvm] f9c7e31 - Correctly report modified status for HWAddressSanitizer
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 18 01:28:18 PDT 2020
Author: serge-sans-paille
Date: 2020-06-18T10:27:44+02:00
New Revision: f9c7e3136ed9c5193699133c0b7deb75cfcfbec0
URL: https://github.com/llvm/llvm-project/commit/f9c7e3136ed9c5193699133c0b7deb75cfcfbec0
DIFF: https://github.com/llvm/llvm-project/commit/f9c7e3136ed9c5193699133c0b7deb75cfcfbec0.diff
LOG: Correctly report modified status for HWAddressSanitizer
Differential Revision: https://reviews.llvm.org/D81238
Added:
Modified:
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 42882f82aa27..5a90d8935f74 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1121,19 +1121,22 @@ bool HWAddressSanitizer::sanitizeFunction(Function &F) {
initializeCallbacks(*F.getParent());
+ bool Changed = false;
+
if (!LandingPadVec.empty())
- instrumentLandingPads(LandingPadVec);
+ Changed |= instrumentLandingPads(LandingPadVec);
if (AllocasToInstrument.empty() && F.hasPersonalityFn() &&
F.getPersonalityFn()->getName() == kHwasanPersonalityThunkName) {
// __hwasan_personality_thunk is a no-op for functions without an
// instrumented stack, so we can drop it.
F.setPersonalityFn(nullptr);
+ Changed = true;
}
if (AllocasToInstrument.empty() && OperandsToInstrument.empty() &&
IntrinToInstrument.empty())
- return false;
+ return Changed;
assert(!LocalDynamicShadow);
@@ -1143,14 +1146,11 @@ bool HWAddressSanitizer::sanitizeFunction(Function &F) {
/*WithFrameRecord*/ ClRecordStackHistory &&
!AllocasToInstrument.empty());
- bool Changed = false;
if (!AllocasToInstrument.empty()) {
Value *StackTag =
ClGenerateTagsWithCalls ? nullptr : getStackBaseTag(EntryIRB);
- Changed |= instrumentStack(AllocasToInstrument, AllocaDbgMap, RetVec,
- StackTag);
+ instrumentStack(AllocasToInstrument, AllocaDbgMap, RetVec, StackTag);
}
-
// Pad and align each of the allocas that we instrumented to stop small
// uninteresting allocas from hiding in instrumented alloca's padding and so
// that we have enough space to store real tags for short granules.
@@ -1211,18 +1211,17 @@ bool HWAddressSanitizer::sanitizeFunction(Function &F) {
}
for (auto &Operand : OperandsToInstrument)
- Changed |= instrumentMemAccess(Operand);
+ instrumentMemAccess(Operand);
if (ClInstrumentMemIntrinsics && !IntrinToInstrument.empty()) {
for (auto Inst : IntrinToInstrument)
instrumentMemIntrinsic(cast<MemIntrinsic>(Inst));
- Changed = true;
}
LocalDynamicShadow = nullptr;
StackBaseTag = nullptr;
- return Changed;
+ return true;
}
void HWAddressSanitizer::instrumentGlobal(GlobalVariable *GV, uint8_t Tag) {
More information about the llvm-commits
mailing list