Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 7e5531e

Browse files
committed
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
1 parent 7230d55 commit 7e5531e

File tree

1 file changed

+1
-27
lines changed

1 file changed

+1
-27
lines changed

lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,6 @@ static bool tryPromoteAllocaToVector(AllocaInst *Alloca) {
477477
}
478478

479479
static bool isCallPromotable(CallInst *CI) {
480-
// TODO: We might be able to handle some cases where the callee is a
481-
// constantexpr bitcast of a function.
482-
if (!CI->getCalledFunction())
483-
return false;
484-
485480
IntrinsicInst *II = dyn_cast<IntrinsicInst>(CI);
486481
if (!II)
487482
return false;
@@ -773,28 +768,7 @@ void AMDGPUPromoteAlloca::handleAlloca(AllocaInst &I) {
773768
continue;
774769
}
775770

776-
IntrinsicInst *Intr = dyn_cast<IntrinsicInst>(Call);
777-
if (!Intr) {
778-
// FIXME: What is this for? It doesn't make sense to promote arbitrary
779-
// function calls. If the call is to a defined function that can also be
780-
// promoted, we should be able to do this once that function is also
781-
// rewritten.
782-
783-
std::vector<Type*> ArgTypes;
784-
for (unsigned ArgIdx = 0, ArgEnd = Call->getNumArgOperands();
785-
ArgIdx != ArgEnd; ++ArgIdx) {
786-
ArgTypes.push_back(Call->getArgOperand(ArgIdx)->getType());
787-
}
788-
Function *F = Call->getCalledFunction();
789-
FunctionType *NewType = FunctionType::get(Call->getType(), ArgTypes,
790-
F->isVarArg());
791-
Constant *C = Mod->getOrInsertFunction((F->getName() + ".local").str(),
792-
NewType, F->getAttributes());
793-
Function *NewF = cast<Function>(C);
794-
Call->setCalledFunction(NewF);
795-
continue;
796-
}
797-
771+
IntrinsicInst *Intr = cast<IntrinsicInst>(Call);
798772
Builder.SetInsertPoint(Intr);
799773
switch (Intr->getIntrinsicID()) {
800774
case Intrinsic::lifetime_start:

0 commit comments

Comments
 (0)