mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-27 04:18:42 +00:00
Store the global variable that's created so that it's reclaimed afterwards.
This plugs a memory leak in ARM's FastISel by storing the GV in Module so that it's reclaimed. PR17978 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198160 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1 parent
827176c80c
commit
c956500eb6
1 file changed
+3
-1
@@ -77,6 +77,7 @@ class ARMFastISel : public FastISel {
|
|||||||
|
|
||||||
/// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
|
/// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
|
||||||
/// make the right decision when generating code for different targets.
|
/// make the right decision when generating code for different targets.
|
||||||
|
Module &M;
|
||||||
const ARMSubtarget *Subtarget;
|
const ARMSubtarget *Subtarget;
|
||||||
const TargetMachine &TM;
|
const TargetMachine &TM;
|
||||||
const TargetInstrInfo &TII;
|
const TargetInstrInfo &TII;
|
||||||
@@ -91,6 +92,7 @@ class ARMFastISel : public FastISel {
|
|||||||
explicit ARMFastISel(FunctionLoweringInfo &funcInfo,
|
explicit ARMFastISel(FunctionLoweringInfo &funcInfo,
|
||||||
const TargetLibraryInfo *libInfo)
|
const TargetLibraryInfo *libInfo)
|
||||||
: FastISel(funcInfo, libInfo),
|
: FastISel(funcInfo, libInfo),
|
||||||
|
M(const_cast<Module&>(*funcInfo.Fn->getParent())),
|
||||||
TM(funcInfo.MF->getTarget()),
|
TM(funcInfo.MF->getTarget()),
|
||||||
TII(*TM.getInstrInfo()),
|
TII(*TM.getInstrInfo()),
|
||||||
TLI(*TM.getTargetLowering()) {
|
TLI(*TM.getTargetLowering()) {
|
||||||
@@ -2244,7 +2246,7 @@ unsigned ARMFastISel::getLibcallReg(const Twine &Name) {
|
|||||||
EVT LCREVT = TLI.getValueType(GVTy);
|
EVT LCREVT = TLI.getValueType(GVTy);
|
||||||
if (!LCREVT.isSimple()) return 0;
|
if (!LCREVT.isSimple()) return 0;
|
||||||
|
|
||||||
GlobalValue *GV = new GlobalVariable(Type::getInt32Ty(*Context), false,
|
GlobalValue *GV = new GlobalVariable(M, Type::getInt32Ty(*Context), false,
|
||||||
GlobalValue::ExternalLinkage, 0, Name);
|
GlobalValue::ExternalLinkage, 0, Name);
|
||||||
assert(GV->getType() == GVTy && "We miscomputed the type for the global!");
|
assert(GV->getType() == GVTy && "We miscomputed the type for the global!");
|
||||||
return ARMMaterializeGV(GV, LCREVT.getSimpleVT());
|
return ARMMaterializeGV(GV, LCREVT.getSimpleVT());
|
||||||
|
|||||||
Reference in new issue
Block a user