diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index 37103a93969cc..f712dc912edd0 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -38,8 +38,8 @@ #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" -#include "llvm/IR/Value.h" #include "llvm/IR/NoFolder.h" +#include "llvm/IR/Value.h" #include "llvm/Support/Alignment.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" @@ -867,6 +867,12 @@ struct AccessAsInstructionInfo : DenseMapInfo { /// A type to track pointer/struct usage and accesses for AAPointerInfo. struct AA::PointerInfo::State : public AbstractState { + ~State() { + // We do not delete the Accesses objects but need to destroy them still. + for (auto &It : AccessBins) + It.second->~Accesses(); + } + /// Return the best possible representable state. static State getBestState(const State &SIS) { return State(); } @@ -6423,8 +6429,10 @@ ChangeStatus AAHeapToStackFunction::updateImpl(Attributor &A) { Changed = ChangeStatus::CHANGED; continue; } else { - if (APAlign->ugt(llvm::Value::MaximumAlignment) || !APAlign->isPowerOf2()) { - LLVM_DEBUG(dbgs() << "[H2S] Invalid allocation alignment: " << APAlign << "\n"); + if (APAlign->ugt(llvm::Value::MaximumAlignment) || + !APAlign->isPowerOf2()) { + LLVM_DEBUG(dbgs() << "[H2S] Invalid allocation alignment: " << APAlign + << "\n"); AI.Status = AllocationInfo::INVALID; Changed = ChangeStatus::CHANGED; continue;