[llvm] r207737 - ARM: fix memory leak, simplify WoA stack probing
Saleem Abdulrasool
compnerd at compnerd.org
Wed Apr 30 21:19:59 PDT 2014
Author: compnerd
Date: Wed Apr 30 23:19:59 2014
New Revision: 207737
URL: http://llvm.org/viewvc/llvm-project?rev=207737&view=rev
Log:
ARM: fix memory leak, simplify WoA stack probing
This fixes the memory leak introduced with the initial addition of support for
WoA stack probing. Now that the pseudo-instruction expansion can handle an
external symbol, use that to generate the load which simplifies the logic as
well as avoids the memory leak.
Modified:
llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp?rev=207737&r1=207736&r2=207737&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Wed Apr 30 23:19:59 2014
@@ -25,7 +25,6 @@
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Function.h"
-#include "llvm/IR/Module.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Target/TargetOptions.h"
@@ -316,20 +315,15 @@ void ARMFrameLowering::emitPrologue(Mach
.addReg(ARM::R4, RegState::Implicit);
break;
case CodeModel::Large:
- case CodeModel::JITDefault: {
- LLVMContext &Ctx = MF.getMMI().getModule()->getContext();
- const GlobalValue *F =
- Function::Create(FunctionType::get(Type::getVoidTy(Ctx), false),
- GlobalValue::AvailableExternallyLinkage, "__chkstk");
-
+ case CodeModel::JITDefault:
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2MOVi32imm), ARM::R12)
- .addGlobalAddress(F);
+ .addExternalSymbol("__chkstk");
+
BuildMI(MBB, MBBI, dl, TII.get(ARM::BLX))
.addReg(ARM::R12, RegState::Kill)
.addReg(ARM::R4, RegState::Implicit);
break;
}
- }
AddDefaultCC(AddDefaultPred(BuildMI(MBB, MBBI, dl, TII.get(ARM::t2SUBrr),
ARM::SP)
More information about the llvm-commits
mailing list