[llvm] 60ebe90 - [HWAsan] Fix returned PreservedAnalyses
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 16 09:42:28 PDT 2023
Author: Arthur Eubanks
Date: 2023-03-16T09:42:09-07:00
New Revision: 60ebe901ebbaba5be2081d5f7a57b4a5025d071a
URL: https://github.com/llvm/llvm-project/commit/60ebe901ebbaba5be2081d5f7a57b4a5025d071a
DIFF: https://github.com/llvm/llvm-project/commit/60ebe901ebbaba5be2081d5f7a57b4a5025d071a.diff
LOG: [HWAsan] Fix returned PreservedAnalyses
Initialization modifies the module.
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 2690c3021260..ca498d08422f 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -282,7 +282,7 @@ class HWAddressSanitizer {
void setSSI(const StackSafetyGlobalInfo *S) { SSI = S; }
- bool sanitizeFunction(Function &F, FunctionAnalysisManager &FAM);
+ void sanitizeFunction(Function &F, FunctionAnalysisManager &FAM);
void initializeModule();
void createHwasanCtorComdat();
@@ -420,12 +420,9 @@ PreservedAnalyses HWAddressSanitizerPass::run(Module &M,
SSI = &MAM.getResult<StackSafetyGlobalAnalysis>(M);
HWAddressSanitizer HWASan(M, Options.CompileKernel, Options.Recover, SSI);
- bool Modified = false;
auto &FAM = MAM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
for (Function &F : M)
- Modified |= HWASan.sanitizeFunction(F, FAM);
- if (!Modified)
- return PreservedAnalyses::all();
+ HWASan.sanitizeFunction(F, FAM);
PreservedAnalyses PA = PreservedAnalyses::none();
// GlobalsAA is considered stateless and does not get invalidated unless
@@ -1402,13 +1399,13 @@ bool HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
return true;
}
-bool HWAddressSanitizer::sanitizeFunction(Function &F,
+void HWAddressSanitizer::sanitizeFunction(Function &F,
FunctionAnalysisManager &FAM) {
if (&F == HwasanCtorFunction)
- return false;
+ return;
if (!F.hasFnAttribute(Attribute::SanitizeHWAddress))
- return false;
+ return;
LLVM_DEBUG(dbgs() << "Function: " << F.getName() << "\n");
@@ -1436,22 +1433,19 @@ bool HWAddressSanitizer::sanitizeFunction(Function &F,
initializeCallbacks(*F.getParent());
- bool Changed = false;
-
if (!LandingPadVec.empty())
- Changed |= instrumentLandingPads(LandingPadVec);
+ instrumentLandingPads(LandingPadVec);
if (SInfo.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 (SInfo.AllocasToInstrument.empty() && OperandsToInstrument.empty() &&
IntrinToInstrument.empty())
- return Changed;
+ return;
assert(!ShadowBase);
@@ -1495,8 +1489,6 @@ bool HWAddressSanitizer::sanitizeFunction(Function &F,
ShadowBase = nullptr;
StackBaseTag = nullptr;
CachedSP = nullptr;
-
- return true;
}
void HWAddressSanitizer::instrumentGlobal(GlobalVariable *GV, uint8_t Tag) {
More information about the llvm-commits
mailing list