Skip to content

Commit 12f0b05

Browse files
dlei6gigcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: 4842d9d
Bug fixes to enable function pointers directly passed by FE
1 parent 1f4d6fe commit 12f0b05

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

IGC/AdaptorCommon/ProcessFuncAttributes.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,8 @@ bool ProcessFuncAttributes::runOnModule(Module& M)
322322
for (auto I : F->users()) {
323323
if (CallInst* callInst = dyn_cast<CallInst>(&*I)) {
324324
// Go through call sites and remove NoInline atrributes.
325-
// Verifier fails if a call has optnone but not noinline, so if we remove noinline, we must also remove optnone
326325
if (callInst->hasFnAttr(llvm::Attribute::NoInline)) {
327326
callInst->removeAttribute(AttributeList::FunctionIndex, llvm::Attribute::NoInline);
328-
callInst->removeAttribute(AttributeList::FunctionIndex, llvm::Attribute::OptimizeNone);
329327
}
330328
// Remove AlwaysInline at callsites
331329
if (isOptDisable && callInst->hasFnAttr(llvm::Attribute::AlwaysInline)) {

IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,10 +1635,7 @@ namespace //Anonymous
16351635
}
16361636
}
16371637

1638-
// Remove function pointer from instructions
1639-
// FIXME: Allowing function pointer calls directly passed by FE will cause regressions due to implicit args
1640-
// not being supported by indirect calls. When runtime turns on support, we should remove the following code
1641-
// to allow function pointer usage in all cases.
1638+
// remove function pointers
16421639
auto nullPtrConst = llvm::ConstantPointerNull::get(Type::getInt8PtrTy(M.getContext()));
16431640
for (auto& func : M.functions())
16441641
{
@@ -1648,8 +1645,11 @@ namespace //Anonymous
16481645
{
16491646
if (!isa<llvm::Constant>(user)) {
16501647
user->replaceUsesOfWith(&func, nullPtrConst);
1651-
changed = true;
16521648
}
1649+
else {
1650+
user->replaceAllUsesWith(llvm::Constant::getNullValue(user->getType()));
1651+
}
1652+
changed = true;
16531653
}
16541654
}
16551655
}
@@ -2153,7 +2153,7 @@ namespace //Anonymous
21532153
{
21542154
return std::unique_ptr<StructValue>(new NullStructValue(sourceValue));
21552155
}
2156-
// Not a block description struct
2156+
IGC_ASSERT_MESSAGE(0, "should not be here");
21572157
return nullptr;
21582158
}
21592159

IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryUsageAnalysis.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,15 @@ bool PrivateMemoryUsageAnalysis::runOnFunction(Function& F)
146146
}
147147
}
148148

149+
//Add private memory implicit arg
150+
SmallVector<ImplicitArg::ArgType, ImplicitArg::NUM_IMPLICIT_ARGS> implicitArgs;
151+
implicitArgs.push_back(ImplicitArg::R0);
152+
149153
if (m_hasPrivateMem)
150154
{
151-
//Add private memory implicit arg
152-
SmallVector<ImplicitArg::ArgType, ImplicitArg::NUM_IMPLICIT_ARGS> implicitArgs;
153-
implicitArgs.push_back(ImplicitArg::R0);
154155
implicitArgs.push_back(ImplicitArg::PRIVATE_BASE);
155-
ImplicitArgs::addImplicitArgs(F, implicitArgs, getAnalysis<MetaDataUtilsWrapper>().getMetaDataUtils());
156156
}
157+
ImplicitArgs::addImplicitArgs(F, implicitArgs, getAnalysis<MetaDataUtilsWrapper>().getMetaDataUtils());
157158

158159
return true;
159160
}

IGC/Compiler/Optimizer/OpenCLPasses/ProgramScopeConstants/ProgramScopeConstantAnalysis.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,7 @@ void ProgramScopeConstantAnalysis::addData(Constant* initializer,
485485
if (Constant * C = dyn_cast<Constant>(&Op))
486486
addData(C, inlineProgramScopeBuffer, pointerOffsetInfoList, inlineProgramScopeOffsets, addressSpace);
487487
}
488-
else if (ce->getOpcode() == Instruction::AddrSpaceCast ||
489-
ce->getOpcode() == Instruction::BitCast)
488+
else if (ce->getOpcode() == Instruction::AddrSpaceCast)
490489
{
491490
if (Constant * C = dyn_cast<Constant>(ce->getOperand(0)))
492491
addData(C, inlineProgramScopeBuffer, pointerOffsetInfoList, inlineProgramScopeOffsets, addressSpace);

0 commit comments

Comments
 (0)