Author: hans Date: Thu Jul 28 18:10:33 2016 New Revision: 277076 URL: http://llvm.org/viewvc/llvm-project?rev=277076&view=rev Log: Merging r275868: ------------------------------------------------------------------------ r275868 | arsenm | 2016-07-18 11:34:48 -0700 (Mon, 18 Jul 2016) | 4 lines
AMDGPU: Remove dead code and redundant check Non intrinsic calls aren't really handled, and this IntrinsicInst dyn_cast checks for the function for us. ------------------------------------------------------------------------ Modified: llvm/branches/release_39/ (props changed) llvm/branches/release_39/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp Propchange: llvm/branches/release_39/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Jul 28 18:10:33 2016 @@ -1,3 +1,3 @@ /llvm/branches/Apple/Pertwee:110850,110961 /llvm/branches/type-system-rewrite:133420-134817 -/llvm/trunk:155241,275870,275879,275898,275928,275935,275946,275978,275981,276015,276077,276109,276181,276209,276236-276237,276358,276364,276368,276389,276438,276479,276510,276740 +/llvm/trunk:155241,275868,275870,275879,275898,275928,275935,275946,275978,275981,276015,276077,276109,276181,276209,276236-276237,276358,276364,276368,276389,276438,276479,276510,276740 Modified: llvm/branches/release_39/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp?rev=277076&r1=277075&r2=277076&view=diff ============================================================================== --- llvm/branches/release_39/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp (original) +++ llvm/branches/release_39/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp Thu Jul 28 18:10:33 2016 @@ -477,11 +477,6 @@ static bool tryPromoteAllocaToVector(All } static bool isCallPromotable(CallInst *CI) { - // TODO: We might be able to handle some cases where the callee is a - // constantexpr bitcast of a function. - if (!CI->getCalledFunction()) - return false; - IntrinsicInst *II = dyn_cast<IntrinsicInst>(CI); if (!II) return false; @@ -773,28 +768,7 @@ void AMDGPUPromoteAlloca::handleAlloca(A continue; } - IntrinsicInst *Intr = dyn_cast<IntrinsicInst>(Call); - if (!Intr) { - // FIXME: What is this for? It doesn't make sense to promote arbitrary - // function calls. If the call is to a defined function that can also be - // promoted, we should be able to do this once that function is also - // rewritten. - - std::vector<Type*> ArgTypes; - for (unsigned ArgIdx = 0, ArgEnd = Call->getNumArgOperands(); - ArgIdx != ArgEnd; ++ArgIdx) { - ArgTypes.push_back(Call->getArgOperand(ArgIdx)->getType()); - } - Function *F = Call->getCalledFunction(); - FunctionType *NewType = FunctionType::get(Call->getType(), ArgTypes, - F->isVarArg()); - Constant *C = Mod->getOrInsertFunction((F->getName() + ".local").str(), - NewType, F->getAttributes()); - Function *NewF = cast<Function>(C); - Call->setCalledFunction(NewF); - continue; - } - + IntrinsicInst *Intr = cast<IntrinsicInst>(Call); Builder.SetInsertPoint(Intr); switch (Intr->getIntrinsicID()) { case Intrinsic::lifetime_start: _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits