[llvm] 2ac37df - [Attributor][FIX] Try to prevent a potential memory leak
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 14 08:43:04 PST 2022
Author: Johannes Doerfert
Date: 2022-12-14T08:42:21-08:00
New Revision: 2ac37df5d7f385dbf9c9456aae1cc6d0d98587ef
URL: https://github.com/llvm/llvm-project/commit/2ac37df5d7f385dbf9c9456aae1cc6d0d98587ef
DIFF: https://github.com/llvm/llvm-project/commit/2ac37df5d7f385dbf9c9456aae1cc6d0d98587ef.diff
LOG: [Attributor][FIX] Try to prevent a potential memory leak
We might not have registered an AA allocated via the bump allocator
and consequently not deallocated it properly.
Added:
Modified:
llvm/include/llvm/Transforms/IPO/Attributor.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index f7c430065fb4a..3b56653985aa5 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1519,14 +1519,16 @@ struct Attributor {
// Use the static create method.
auto &AA = AAType::createForPosition(IRP, *this);
+ // Always register a new attribute to make sure we clean up the allocated
+ // memory properly.
+ registerAA(AA);
+
// If we are currenty seeding attributes, enforce seeding rules.
if (Phase == AttributorPhase::SEEDING && !shouldSeedAttribute(AA)) {
AA.getState().indicatePessimisticFixpoint();
return AA;
}
- registerAA(AA);
-
// For now we ignore naked and optnone functions.
bool Invalidate =
Configuration.Allowed && !Configuration.Allowed->count(&AAType::ID);
More information about the llvm-commits
mailing list