llvm.org GIT mirror llvm / 7e5531e
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. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_39@277076 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 4 years ago
1 changed file(s) with 1 addition(s) and 27 deletion(s). Raw diff Collapse all Expand all
476476 }
477477
478478 static bool isCallPromotable(CallInst *CI) {
479 // TODO: We might be able to handle some cases where the callee is a
480 // constantexpr bitcast of a function.
481 if (!CI->getCalledFunction())
482 return false;
483
484479 IntrinsicInst *II = dyn_cast(CI);
485480 if (!II)
486481 return false;
772767 continue;
773768 }
774769
775 IntrinsicInst *Intr = dyn_cast(Call);
776 if (!Intr) {
777 // FIXME: What is this for? It doesn't make sense to promote arbitrary
778 // function calls. If the call is to a defined function that can also be
779 // promoted, we should be able to do this once that function is also
780 // rewritten.
781
782 std::vector ArgTypes;
783 for (unsigned ArgIdx = 0, ArgEnd = Call->getNumArgOperands();
784 ArgIdx != ArgEnd; ++ArgIdx) {
785 ArgTypes.push_back(Call->getArgOperand(ArgIdx)->getType());
786 }
787 Function *F = Call->getCalledFunction();
788 FunctionType *NewType = FunctionType::get(Call->getType(), ArgTypes,
789 F->isVarArg());
790 Constant *C = Mod->getOrInsertFunction((F->getName() + ".local").str(),
791 NewType, F->getAttributes());
792 Function *NewF = cast(C);
793 Call->setCalledFunction(NewF);
794 continue;
795 }
796
770 IntrinsicInst *Intr = cast(Call);
797771 Builder.SetInsertPoint(Intr);
798772 switch (Intr->getIntrinsicID()) {
799773 case Intrinsic::lifetime_start: