Skip to content

Commit 6c3cc95

Browse files
Anton Sidorenkoigcbot
Anton Sidorenko
authored andcommitted
[Autobackout][FuncReg]Revert of change: 8d1656d
Enable trampoline insertion pass by default TrampolineInsertion pass must be enabled by default to make VISA and binary linking possible.
1 parent 41cdbfd commit 6c3cc95

File tree

4 files changed

+14
-18
lines changed

4 files changed

+14
-18
lines changed

IGC/VectorCompiler/include/vc/Utils/GenX/KernelInfo.h

+5-12
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ SPDX-License-Identifier: MIT
99
#ifndef VC_UTILS_GENX_KERNELINFO_H
1010
#define VC_UTILS_GENX_KERNELINFO_H
1111

12-
#include "vc/InternalIntrinsics/InternalIntrinsics.h"
1312
#include "vc/Utils/GenX/InternalMetadata.h"
14-
#include "vc/Utils/GenX/Intrinsics.h"
1513
#include "vc/Utils/GenX/RegCategory.h"
1614

1715
#include "Probe/Assertion.h"
@@ -90,18 +88,13 @@ inline bool isIndirect(const llvm::Function *F) {
9088
// structure types is fixed for intrinsics.
9189
if (llvm::GenXIntrinsic::isAnyNonTrivialIntrinsic(F))
9290
return false;
93-
if (vc::InternalIntrinsic::isInternalNonTrivialIntrinsic(F))
94-
return false;
95-
if (vc::isKernel(F))
96-
return false;
97-
if (vc::isEmulationFunction(*F))
98-
return false;
99-
if (!F->hasAddressTaken() && F->hasLocalLinkage())
100-
return false;
91+
// FIXME: The condition of which function is considered to be indirectly
92+
// called will be changed soon.
93+
bool IsIndirect = F->hasAddressTaken();
10194
IGC_ASSERT_MESSAGE(
102-
requiresStackCall(F),
95+
!IsIndirect || requiresStackCall(F),
10396
"The indirectly-called function is expected to be a stack call");
104-
return true;
97+
return IsIndirect;
10598
}
10699

107100
inline bool isIndirect(const llvm::Function &F) { return isIndirect(&F); }

IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -5431,6 +5431,10 @@ void GenXKernelBuilder::buildInlineAsm(CallInst *CI) {
54315431
void GenXKernelBuilder::buildCall(CallInst *CI, const DstOpndDesc &DstDesc) {
54325432
LLVM_DEBUG(dbgs() << CI << "\n");
54335433
Function *Callee = CI->getCalledFunction();
5434+
IGC_ASSERT_MESSAGE(
5435+
!Callee || !Callee->isDeclaration(),
5436+
"Currently VC backend does not support modules with external functions");
5437+
54345438
if (!Callee || vc::requiresStackCall(Callee)) {
54355439
if (UseNewStackBuilder)
54365440
buildStackCallLight(CI, DstDesc);

IGC/VectorCompiler/lib/GenXCodeGen/GenXGlobalValueLowering.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,10 @@ void GenXGlobalValueLowering::fillWorkListForGVInstUse(Use &GVUse) {
208208
GenXIntrinsic::genx_gaddr,
209209
"llvm.gaddr must be inserted by this pass, but someone "
210210
"inserted it before");
211-
// Do not skip direct calls as an indirectly-called function can be called
212-
// only indirectly. See GenXTrampolineInsertion
211+
// Skipping direct calls. Relocating will make them indirect.
212+
if (isa<Function>(ConstWithGV) && isa<CallInst>(Usr) &&
213+
cast<CallInst>(Usr)->getCalledFunction() == cast<Function>(ConstWithGV))
214+
return;
213215
Function *Func = Usr->getParent()->getParent();
214216
WorkList[Func].Users.insert({Usr, GVUse.getOperandNo()});
215217
WorkList[Func].Replacement[ConstWithGV] = nullptr;

IGC/VectorCompiler/lib/GenXOpts/CMTrans/GenXTrampolineInsertion.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ SPDX-License-Identifier: MIT
5252

5353
#include "llvmWrapper/IR/Value.h"
5454
#include "vc/GenXOpts/GenXOpts.h"
55-
#include "vc/InternalIntrinsics/InternalIntrinsics.h"
5655
#include "vc/Support/BackendConfig.h"
5756
#include "vc/Utils/GenX/Intrinsics.h"
5857
#include "vc/Utils/GenX/KernelInfo.h"
@@ -68,7 +67,7 @@ using namespace llvm;
6867

6968
static cl::opt<bool> EnableTrampolineInsertion(
7069
"vc-enable-trampoline-insertion",
71-
llvm::cl::desc("Enable/disable GenXTrampolineInsertion"), cl::init(true),
70+
llvm::cl::desc("Enable/disable GenXTrampolineInsertion"), cl::init(false),
7271
cl::Hidden);
7372

7473
namespace {
@@ -100,8 +99,6 @@ class GenXTrampolineInsertion : public ModulePass,
10099
void GenXTrampolineInsertion::visitFunction(Function &F) {
101100
if (GenXIntrinsic::isAnyNonTrivialIntrinsic(&F))
102101
return;
103-
if (vc::InternalIntrinsic::isInternalNonTrivialIntrinsic(&F))
104-
return;
105102
if (vc::isEmulationFunction(F))
106103
return;
107104
if (vc::isKernel(&F))

0 commit comments

Comments
 (0)