Skip to content

Commit b5cc222

Browse files
authored
[MIR] Fix vreg flag vector memory leak (#112479)
A fix-it patch for dbfca24 #110228. No need for a container. This allows 8 flags for a register. The virtual register flags vector had a memory leak because the vector's memory is not freed. The `BumpPtrAllocator` handles the deallocation and missed calling the `std::vector<uint8_t> Flags` destructor.
1 parent 1d40fef commit b5cc222

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/include/llvm/CodeGen/MIRParser/MIParser.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct VRegInfo {
4545
} D;
4646
Register VReg;
4747
Register PreferredReg;
48-
std::vector<uint8_t> Flags;
48+
uint8_t Flags = 0;
4949
};
5050

5151
using Name2RegClassMap = StringMap<const TargetRegisterClass *>;

llvm/lib/CodeGen/MIRParser/MIRParser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
703703
return error(FlagStringValue.SourceRange.Start,
704704
Twine("use of undefined register flag '") +
705705
FlagStringValue.Value + "'");
706-
Info.Flags.push_back(FlagValue);
706+
Info.Flags |= FlagValue;
707707
}
708708
RegInfo.noteNewVirtualRegister(Info.VReg);
709709
}

0 commit comments

Comments
 (0)