diff options
author | Johannes Doerfert <johannes@jdoerfert.de> | 2022-12-14 08:40:17 -0800 |
---|---|---|
committer | Johannes Doerfert <johannes@jdoerfert.de> | 2022-12-14 08:42:21 -0800 |
commit | 2ac37df5d7f385dbf9c9456aae1cc6d0d98587ef (patch) | |
tree | e702a7c76b36895352ae94687e025d262afc4032 | |
parent | e84d1879e51f543d2cdeaca3b4ae7786ea3f19b5 (diff) | |
download | llvm-2ac37df5d7f385dbf9c9456aae1cc6d0d98587ef.zip llvm-2ac37df5d7f385dbf9c9456aae1cc6d0d98587ef.tar.gz llvm-2ac37df5d7f385dbf9c9456aae1cc6d0d98587ef.tar.bz2 |
[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.
-rw-r--r-- | llvm/include/llvm/Transforms/IPO/Attributor.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h index f7c4300..3b56653 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); |