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);