Skip to content

Commit 0e9899f

Browse files
committed
Fix nullptr in releaseMemory and mfprops
1 parent 7f35339 commit 0e9899f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

llvm/include/llvm/CodeGen/LiveDebugVariables.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ class LiveDebugVariablesWrapperLegacy : public MachineFunctionPass {
8181
LiveDebugVariables &getLDV() { return *Impl; }
8282
const LiveDebugVariables &getLDV() const { return *Impl; }
8383

84-
void releaseMemory() override { Impl->releaseMemory(); }
84+
void releaseMemory() override {
85+
if (Impl)
86+
Impl->releaseMemory();
87+
}
8588
void getAnalysisUsage(AnalysisUsage &) const override;
8689

8790
MachineFunctionProperties getSetProperties() const override {
@@ -97,6 +100,12 @@ class LiveDebugVariablesAnalysis
97100

98101
public:
99102
using Result = LiveDebugVariables;
103+
104+
MachineFunctionProperties getSetProperties() const {
105+
return MachineFunctionProperties().set(
106+
MachineFunctionProperties::Property::TracksDebugUserValues);
107+
}
108+
100109
Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM);
101110
};
102111

llvm/lib/CodeGen/LiveDebugVariables.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "llvm/CodeGen/MachineInstr.h"
3939
#include "llvm/CodeGen/MachineInstrBuilder.h"
4040
#include "llvm/CodeGen/MachineOperand.h"
41+
#include "llvm/CodeGen/MachinePassManager.h"
4142
#include "llvm/CodeGen/MachineRegisterInfo.h"
4243
#include "llvm/CodeGen/SlotIndexes.h"
4344
#include "llvm/CodeGen/TargetInstrInfo.h"
@@ -1323,6 +1324,8 @@ AnalysisKey LiveDebugVariablesAnalysis::Key;
13231324
LiveDebugVariables
13241325
LiveDebugVariablesAnalysis::run(MachineFunction &MF,
13251326
MachineFunctionAnalysisManager &MFAM) {
1327+
MFPropsModifier _(*this, MF);
1328+
13261329
auto *LIS = &MFAM.getResult<LiveIntervalsAnalysis>(MF);
13271330
LiveDebugVariables LDV;
13281331
LDV.analyze(MF, LIS);

0 commit comments

Comments
 (0)