llvm.org GIT mirror llvm / a1a235f
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207737 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 6 years ago
1 changed file(s) with 3 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
2424 #include "llvm/CodeGen/RegisterScavenging.h"
2525 #include "llvm/IR/CallingConv.h"
2626 #include "llvm/IR/Function.h"
27 #include "llvm/IR/Module.h"
2827 #include "llvm/MC/MCContext.h"
2928 #include "llvm/Support/CommandLine.h"
3029 #include "llvm/Target/TargetOptions.h"
315314 .addReg(ARM::R4, RegState::Implicit);
316315 break;
317316 case CodeModel::Large:
318 case CodeModel::JITDefault: {
319 LLVMContext &Ctx = MF.getMMI().getModule()->getContext();
320 const GlobalValue *F =
321 Function::Create(FunctionType::get(Type::getVoidTy(Ctx), false),
322 GlobalValue::AvailableExternallyLinkage, "__chkstk");
323
317 case CodeModel::JITDefault:
324318 BuildMI(MBB, MBBI, dl, TII.get(ARM::t2MOVi32imm), ARM::R12)
325 .addGlobalAddress(F);
319 .addExternalSymbol("__chkstk");
320
326321 BuildMI(MBB, MBBI, dl, TII.get(ARM::BLX))
327322 .addReg(ARM::R12, RegState::Kill)
328323 .addReg(ARM::R4, RegState::Implicit);
329324 break;
330 }
331325 }
332326
333327 AddDefaultCC(AddDefaultPred(BuildMI(MBB, MBBI, dl, TII.get(ARM::t2SUBrr),