From: Benjamin Kramer Date: Wed, 23 Jan 2013 15:21:44 +0000 (+0000) Subject: NVPTX: Stop leaking memory by using a managed constant instead of a new Argument. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e735945ad74a4af9772a7d9bb45418b2551fffe9;p=oota-llvm.git NVPTX: Stop leaking memory by using a managed constant instead of a new Argument. This is still an egregious hack since we don't have a nice interface for this kind of thing but should help the valgrind leak check buildbot to become green. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173267 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/NVPTX/NVPTXISelLowering.cpp b/lib/Target/NVPTX/NVPTXISelLowering.cpp index b3ab9fc9d02..2699cea8f66 100644 --- a/lib/Target/NVPTX/NVPTXISelLowering.cpp +++ b/lib/Target/NVPTX/NVPTXISelLowering.cpp @@ -1027,9 +1027,11 @@ NVPTXTargetLowering::LowerFormalArguments(SDValue Chain, if (isABI || isKernel) { // If ABI, load from the param symbol SDValue Arg = getParamSymbol(DAG, idx); - Value *srcValue = new Argument(PointerType::get(ObjectVT.getTypeForEVT( - F->getContext()), - llvm::ADDRESS_SPACE_PARAM)); + // Conjure up a value that we can get the address space from. + // FIXME: Using a constant here is a hack. + Value *srcValue = Constant::getNullValue(PointerType::get( + ObjectVT.getTypeForEVT(F->getContext()), + llvm::ADDRESS_SPACE_PARAM)); SDValue p = DAG.getLoad(ObjectVT, dl, Root, Arg, MachinePointerInfo(srcValue), false, false, false,