ispc: rebuild for llvm12
This commit is contained in:
parent
f2f581e8a9
commit
feccc72c40
|
@ -0,0 +1,57 @@
|
|||
From 1c0f89dccb774f216c7f6e76a99ee907a1e641cb Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Babokin <dmitry.y.babokin@intel.com>
|
||||
Date: Tue, 22 Dec 2020 17:03:59 -0800
|
||||
Subject: [PATCH] Fix to work with LLVM trunk after llvm/llvm-project@41c3b2713
|
||||
|
||||
---
|
||||
src/ctx.cpp | 18 ++++++++++++------
|
||||
1 file changed, 12 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/ctx.cpp b/src/ctx.cpp
|
||||
index 6fbb8b9cf..977e9d222 100644
|
||||
--- a/src/ctx.cpp
|
||||
+++ b/src/ctx.cpp
|
||||
@@ -1473,11 +1473,15 @@ void FunctionEmitContext::AddDebugPos(llvm::Value *value, const SourcePos *pos,
|
||||
llvm::Instruction *inst = llvm::dyn_cast<llvm::Instruction>(value);
|
||||
if (inst != NULL && m->diBuilder) {
|
||||
SourcePos p = pos ? *pos : currentPos;
|
||||
- if (p.first_line != 0)
|
||||
+ if (p.first_line != 0) {
|
||||
// If first_line == 0, then we're in the middle of setting up
|
||||
// the standard library or the like; don't add debug positions
|
||||
// for those functions
|
||||
- inst->setDebugLoc(llvm::DebugLoc::get(p.first_line, p.first_column, scope ? scope : GetDIScope()));
|
||||
+ scope = scope ? scope : GetDIScope();
|
||||
+ llvm::DebugLoc diLoc =
|
||||
+ llvm::DILocation::get(scope->getContext(), p.first_line, p.first_column, scope, nullptr, false);
|
||||
+ inst->setDebugLoc(diLoc);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1518,9 +1522,10 @@ void FunctionEmitContext::EmitVariableDebugInfo(Symbol *sym) {
|
||||
llvm::DILocalVariable *var = m->diBuilder->createAutoVariable(
|
||||
scope, sym->name, sym->pos.GetDIFile(), sym->pos.first_line, diType, true /* preserve through opts */);
|
||||
|
||||
+ llvm::DebugLoc diLoc =
|
||||
+ llvm::DILocation::get(scope->getContext(), sym->pos.first_line, sym->pos.first_column, scope, nullptr, false);
|
||||
llvm::Instruction *declareInst =
|
||||
- m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(),
|
||||
- llvm::DebugLoc::get(sym->pos.first_line, sym->pos.first_column, scope), bblock);
|
||||
+ m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(), diLoc, bblock);
|
||||
AddDebugPos(declareInst, &sym->pos, scope);
|
||||
}
|
||||
|
||||
@@ -1535,9 +1540,10 @@ void FunctionEmitContext::EmitFunctionParameterDebugInfo(Symbol *sym, int argNum
|
||||
m->diBuilder->createParameterVariable(scope, sym->name, argNum + 1, sym->pos.GetDIFile(), sym->pos.first_line,
|
||||
diType, true /* preserve through opts */, flags);
|
||||
|
||||
+ llvm::DebugLoc diLoc =
|
||||
+ llvm::DILocation::get(scope->getContext(), sym->pos.first_line, sym->pos.first_column, scope, nullptr, false);
|
||||
llvm::Instruction *declareInst =
|
||||
- m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(),
|
||||
- llvm::DebugLoc::get(sym->pos.first_line, sym->pos.first_column, scope), bblock);
|
||||
+ m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(), diLoc, bblock);
|
||||
AddDebugPos(declareInst, &sym->pos, scope);
|
||||
}
|
||||
|
|
@ -0,0 +1,923 @@
|
|||
From 0597a79d084c014780136da906afe21d15e982cb Mon Sep 17 00:00:00 2001
|
||||
From: DeepakRajendrakumaran <deepak.rajendrakumaran@intel.com>
|
||||
Date: Tue, 5 Jan 2021 13:53:30 -0800
|
||||
Subject: [PATCH] Remove LLVM 8.0 and LLVM 9.0. (#1966)
|
||||
|
||||
---
|
||||
.appveyor.yml | 3 --
|
||||
.travis.yml | 7 ---
|
||||
CMakeLists.txt | 12 ++----
|
||||
src/ast.cpp | 4 --
|
||||
src/ctx.cpp | 30 -------------
|
||||
src/gen/GlobalsLocalization.cpp | 4 --
|
||||
src/ispc.cpp | 20 ---------
|
||||
src/ispc.h | 3 +-
|
||||
src/ispc_version.h | 4 +-
|
||||
src/main.cpp | 13 ------
|
||||
src/module.cpp | 27 ------------
|
||||
src/module.h | 2 -
|
||||
src/opt.cpp | 64 ++--------------------------
|
||||
src/type.cpp | 10 ++---
|
||||
tests/lit-tests/1771.ispc | 1 -
|
||||
tests/lit-tests/1844.ispc | 3 --
|
||||
tests/lit-tests/1926.ispc | 2 -
|
||||
tests/lit-tests/cpus_x86.ispc | 2 +
|
||||
tests/lit-tests/cpus_x86_llvm10.ispc | 11 -----
|
||||
tests/lit-tests/lit.cfg | 5 ---
|
||||
20 files changed, 14 insertions(+), 213 deletions(-)
|
||||
delete mode 100644 tests/lit-tests/cpus_x86_llvm10.ispc
|
||||
|
||||
diff --git a/.appveyor.yml b/.appveyor.yml
|
||||
index 451a7b3e0..7945cca2a 100644
|
||||
--- a/.appveyor.yml
|
||||
+++ b/.appveyor.yml
|
||||
@@ -41,8 +41,6 @@ environment:
|
||||
LLVM_VERSION: latest
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
LLVM_VERSION: 10.0
|
||||
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
- LLVM_VERSION: 9.0
|
||||
|
||||
for:
|
||||
-
|
||||
@@ -62,7 +60,6 @@ for:
|
||||
if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" ( (set generator="Visual Studio 16") & (set vsversion=2019))
|
||||
set LLVM_TAR=llvm-11.0.0-win.vs2019-Release+Asserts-x86.arm.wasm.7z
|
||||
if "%LLVM_VERSION%"=="10.0" (set LLVM_TAR=llvm-10.0.1-win.vs2019-Release+Asserts-x86.arm.wasm.zip)
|
||||
- if "%LLVM_VERSION%"=="9.0" (set LLVM_TAR=llvm-9.0.1-win.vs2017-Release+Asserts-x86.arm.wasm.zip)
|
||||
install:
|
||||
- ps: choco install --no-progress winflexbison3 wget 7zip
|
||||
- cmd: |-
|
||||
diff --git a/.travis.yml b/.travis.yml
|
||||
index 2e96017a6..3a6b85264 100644
|
||||
--- a/.travis.yml
|
||||
+++ b/.travis.yml
|
||||
@@ -108,13 +108,6 @@ jobs:
|
||||
- LLVM_TAR=llvm-10.0.1-ubuntu16.04-Release+Asserts-x86.arm.wasm.tar.xz
|
||||
- LLVM_REPO=https://github.com/dbabokin/llvm-project
|
||||
- ISPC_HOME=$TRAVIS_BUILD_DIR
|
||||
- # LLVM 9.0 + Ubuntu 16.04: build, lit tests, examples (build + run), benchmarks (build + trial run)
|
||||
- - <<: *my_tag
|
||||
- env:
|
||||
- - LLVM_VERSION=9.0 OS=Ubuntu16.04
|
||||
- - LLVM_TAR=llvm-9.0.1-ubuntu16.04-Release+Asserts-x86.arm.wasm.tar.xz
|
||||
- - LLVM_REPO=https://github.com/dbabokin/llvm-project
|
||||
- - ISPC_HOME=$TRAVIS_BUILD_DIR
|
||||
# WASM enabled build
|
||||
# LLVM 11.0 + Ubuntu 16.04: build, lit tests, examples (build), benchmarks (build + trial run)
|
||||
- <<: *my_tag
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 5fa863fcf..a6b3ed251 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -241,10 +241,8 @@ if (X86_ENABLED)
|
||||
avx2-i8x32 avx2-i16x16
|
||||
avx2-i32x4 avx2-i32x8 avx2-i32x16 avx2-i64x4
|
||||
avx512knl-i32x16
|
||||
- avx512skx-i32x16 avx512skx-i32x8)
|
||||
- if (${LLVM_VERSION_NUMBER} VERSION_GREATER_EQUAL "10.0.0")
|
||||
- list(APPEND ISPC_TARGETS avx512skx-i8x64 avx512skx-i16x32)
|
||||
- endif()
|
||||
+ avx512skx-i32x16 avx512skx-i32x8
|
||||
+ avx512skx-i8x64 avx512skx-i16x32)
|
||||
endif()
|
||||
if (ARM_ENABLED)
|
||||
list(APPEND ISPC_TARGETS neon-i8x16 neon-i16x8 neon-i32x4 neon-i32x8)
|
||||
@@ -259,11 +257,7 @@ if (WASM_ENABLED)
|
||||
endif()
|
||||
|
||||
set(CLANG_LIBRARY_LIST clangFrontend clangDriver clangSerialization clangParse clangSema clangAnalysis clangAST clangBasic clangEdit clangLex)
|
||||
-set(LLVM_COMPONENTS engine ipo bitreader bitwriter instrumentation linker option)
|
||||
-
|
||||
-if (${LLVM_VERSION_NUMBER} VERSION_GREATER_EQUAL "10.0.0")
|
||||
- list(APPEND LLVM_COMPONENTS frontendopenmp)
|
||||
-endif()
|
||||
+set(LLVM_COMPONENTS engine ipo bitreader bitwriter instrumentation linker option frontendopenmp)
|
||||
|
||||
if (X86_ENABLED)
|
||||
list(APPEND LLVM_COMPONENTS x86)
|
||||
diff --git a/src/ast.cpp b/src/ast.cpp
|
||||
index 20f75a29c..5a43c4854 100644
|
||||
--- a/src/ast.cpp
|
||||
+++ b/src/ast.cpp
|
||||
@@ -44,9 +44,7 @@
|
||||
#include "sym.h"
|
||||
#include "util.h"
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
#include <llvm/Support/TimeProfiler.h>
|
||||
-#endif
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ASTNode
|
||||
|
||||
@@ -62,9 +60,7 @@ void AST::AddFunction(Symbol *sym, Stmt *code) {
|
||||
}
|
||||
|
||||
void AST::GenerateIR() {
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope TimeScope("GenerateIR");
|
||||
-#endif
|
||||
for (unsigned int i = 0; i < functions.size(); ++i)
|
||||
functions[i]->GenerateIR();
|
||||
}
|
||||
diff --git a/src/ctx.cpp b/src/ctx.cpp
|
||||
index 977e9d222..42c4ea09d 100644
|
||||
--- a/src/ctx.cpp
|
||||
+++ b/src/ctx.cpp
|
||||
@@ -309,21 +309,13 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym, llvm::F
|
||||
char buf[256];
|
||||
snprintf(buf, sizeof(buf), "__off_all_on_mask_%s", g->target->GetISAString());
|
||||
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_8_0
|
||||
- llvm::Constant *offFunc = m->module->getOrInsertFunction(buf, LLVMTypes::VoidType);
|
||||
-#else // LLVM 9.0+
|
||||
llvm::FunctionCallee offFuncCallee = m->module->getOrInsertFunction(buf, LLVMTypes::VoidType);
|
||||
llvm::Constant *offFunc = llvm::cast<llvm::Constant>(offFuncCallee.getCallee());
|
||||
-#endif
|
||||
AssertPos(currentPos, llvm::isa<llvm::Function>(offFunc));
|
||||
llvm::BasicBlock *offBB = llvm::BasicBlock::Create(*g->ctx, "entry", (llvm::Function *)offFunc, 0);
|
||||
llvm::StoreInst *inst = new llvm::StoreInst(LLVMMaskAllOff, globalAllOnMaskPtr, offBB);
|
||||
if (g->opt.forceAlignedMemory) {
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- inst->setAlignment(g->target->getNativeVectorAlignment());
|
||||
-#else // LLVM 10.0+
|
||||
inst->setAlignment(llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne());
|
||||
-#endif
|
||||
}
|
||||
llvm::ReturnInst::Create(*g->ctx, offBB);
|
||||
}
|
||||
@@ -2288,11 +2280,7 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, const Type *type, c
|
||||
#endif
|
||||
|
||||
if (g->opt.forceAlignedMemory && llvm::dyn_cast<llvm::VectorType>(pt->getElementType())) {
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- inst->setAlignment(g->target->getNativeVectorAlignment());
|
||||
-#else // LLVM 10.0+
|
||||
inst->setAlignment(llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne());
|
||||
-#endif
|
||||
}
|
||||
|
||||
AddDebugPos(inst);
|
||||
@@ -2431,11 +2419,7 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
|
||||
// vs the proper alignment in practice.)
|
||||
int align = 1;
|
||||
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- inst->setAlignment(align);
|
||||
-#else // LLVM 10.0+
|
||||
inst->setAlignment(llvm::MaybeAlign(align).valueOrOne());
|
||||
-#endif
|
||||
}
|
||||
|
||||
AddDebugPos(inst);
|
||||
@@ -2649,11 +2633,7 @@ llvm::Value *FunctionEmitContext::AllocaInst(llvm::Type *llvmType, const char *n
|
||||
align = g->target->getNativeVectorAlignment();
|
||||
|
||||
if (align != 0) {
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- inst->setAlignment(align);
|
||||
-#else // LLVM 10.0+
|
||||
inst->setAlignment(llvm::MaybeAlign(align).valueOrOne());
|
||||
-#endif
|
||||
}
|
||||
// Don't add debugging info to alloca instructions
|
||||
return inst;
|
||||
@@ -2926,11 +2906,7 @@ void FunctionEmitContext::StoreInst(llvm::Value *value, llvm::Value *ptr, const
|
||||
llvm::StoreInst *inst = new llvm::StoreInst(value, ptr, bblock);
|
||||
|
||||
if (g->opt.forceAlignedMemory && llvm::dyn_cast<llvm::VectorType>(pt->getElementType())) {
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- inst->setAlignment(g->target->getNativeVectorAlignment());
|
||||
-#else // LLVM 10.0+
|
||||
inst->setAlignment(llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne());
|
||||
-#endif
|
||||
}
|
||||
|
||||
#ifdef ISPC_GENX_ENABLED
|
||||
@@ -3025,16 +3001,10 @@ void FunctionEmitContext::MemcpyInst(llvm::Value *dest, llvm::Value *src, llvm::
|
||||
}
|
||||
if (align == NULL)
|
||||
align = LLVMInt32(1);
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_8_0
|
||||
- llvm::Constant *mcFunc =
|
||||
- m->module->getOrInsertFunction("llvm.memcpy.p0i8.p0i8.i64", LLVMTypes::VoidType, LLVMTypes::VoidPointerType,
|
||||
- LLVMTypes::VoidPointerType, LLVMTypes::Int64Type, LLVMTypes::BoolType);
|
||||
-#else // LLVM 9.0+
|
||||
llvm::FunctionCallee mcFuncCallee =
|
||||
m->module->getOrInsertFunction("llvm.memcpy.p0i8.p0i8.i64", LLVMTypes::VoidType, LLVMTypes::VoidPointerType,
|
||||
LLVMTypes::VoidPointerType, LLVMTypes::Int64Type, LLVMTypes::BoolType);
|
||||
llvm::Constant *mcFunc = llvm::cast<llvm::Constant>(mcFuncCallee.getCallee());
|
||||
-#endif
|
||||
AssertPos(currentPos, mcFunc != NULL);
|
||||
AssertPos(currentPos, llvm::isa<llvm::Function>(mcFunc));
|
||||
|
||||
diff --git a/src/gen/GlobalsLocalization.cpp b/src/gen/GlobalsLocalization.cpp
|
||||
index 193a66289..a176e9462 100644
|
||||
--- a/src/gen/GlobalsLocalization.cpp
|
||||
+++ b/src/gen/GlobalsLocalization.cpp
|
||||
@@ -470,11 +470,7 @@ void GlobalsLocalization::LocalizeGlobals(LocalizationInfo &LI) {
|
||||
Instruction &FirstI = *Fn->getEntryBlock().begin();
|
||||
Type *ElemTy = GV->getType()->getElementType();
|
||||
AllocaInst *Alloca = new AllocaInst(ElemTy, 0, GV->getName() + ".local", &FirstI);
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- Alloca->setAlignment(GV->getAlignment());
|
||||
-#else // LLVM 10.0+
|
||||
Alloca->setAlignment(llvm::MaybeAlign(GV->getAlignment()));
|
||||
-#endif
|
||||
if (!isa<UndefValue>(GV->getInitializer()))
|
||||
new StoreInst(GV->getInitializer(), Alloca, &FirstI);
|
||||
|
||||
diff --git a/src/ispc.cpp b/src/ispc.cpp
|
||||
index e2d0f206e..fac5233f7 100644
|
||||
--- a/src/ispc.cpp
|
||||
+++ b/src/ispc.cpp
|
||||
@@ -272,9 +272,7 @@ typedef enum {
|
||||
CPU_Silvermont,
|
||||
|
||||
CPU_ICX,
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
CPU_TGL,
|
||||
-#endif
|
||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_12_0
|
||||
CPU_ADL,
|
||||
CPU_SPR,
|
||||
@@ -365,10 +363,8 @@ class AllCPUs {
|
||||
|
||||
names[CPU_ICX].push_back("icelake-server");
|
||||
names[CPU_ICX].push_back("icx");
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
names[CPU_TGL].push_back("tigerlake");
|
||||
names[CPU_TGL].push_back("tgl");
|
||||
-#endif
|
||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_12_0
|
||||
names[CPU_ADL].push_back("alderlake");
|
||||
names[CPU_ADL].push_back("adl");
|
||||
@@ -411,11 +407,9 @@ class AllCPUs {
|
||||
compat[CPU_ADL] = Set(CPU_ADL, CPU_x86_64, CPU_Bonnell, CPU_Penryn, CPU_Core2, CPU_Nehalem, CPU_Silvermont,
|
||||
CPU_SandyBridge, CPU_IvyBridge, CPU_Haswell, CPU_Broadwell, CPU_None);
|
||||
#endif
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
compat[CPU_TGL] =
|
||||
Set(CPU_TGL, CPU_x86_64, CPU_Bonnell, CPU_Penryn, CPU_Core2, CPU_Nehalem, CPU_Silvermont, CPU_SandyBridge,
|
||||
CPU_IvyBridge, CPU_Haswell, CPU_Broadwell, CPU_SKX, CPU_ICL, CPU_ICX, CPU_None);
|
||||
-#endif
|
||||
compat[CPU_ICX] = Set(CPU_ICX, CPU_x86_64, CPU_Bonnell, CPU_Penryn, CPU_Core2, CPU_Nehalem, CPU_Silvermont,
|
||||
CPU_SandyBridge, CPU_IvyBridge, CPU_Haswell, CPU_Broadwell, CPU_SKX, CPU_ICL, CPU_None);
|
||||
|
||||
@@ -556,9 +550,7 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
|
||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_12_0
|
||||
case CPU_SPR:
|
||||
#endif
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
case CPU_TGL:
|
||||
-#endif
|
||||
case CPU_ICX:
|
||||
case CPU_ICL:
|
||||
case CPU_SKX:
|
||||
@@ -916,7 +908,6 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
|
||||
}
|
||||
break;
|
||||
case ISPCTarget::avx512skx_i8x64:
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0 // LLVM 10.0+
|
||||
// This target is enabled only for LLVM 10.0 and later
|
||||
// because LLVM requires a number of fixes, which are
|
||||
// committed to LLVM 11.0 and can be applied to 10.0, but not
|
||||
@@ -937,12 +928,7 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
|
||||
this->m_hasVecPrefetch = false;
|
||||
CPUfromISA = CPU_SKX;
|
||||
break;
|
||||
-#else
|
||||
- unsupported_target = true;
|
||||
- break;
|
||||
-#endif
|
||||
case ISPCTarget::avx512skx_i16x32:
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0 // LLVM 10.0+
|
||||
// This target is enabled only for LLVM 10.0 and later
|
||||
// because LLVM requires a number of fixes, which are
|
||||
// committed to LLVM 11.0 and can be applied to 10.0, but not
|
||||
@@ -963,10 +949,6 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
|
||||
this->m_hasVecPrefetch = false;
|
||||
CPUfromISA = CPU_SKX;
|
||||
break;
|
||||
-#else
|
||||
- unsupported_target = true;
|
||||
- break;
|
||||
-#endif
|
||||
#ifdef ISPC_ARM_ENABLED
|
||||
case ISPCTarget::neon_i8x16:
|
||||
this->m_isa = Target::NEON;
|
||||
@@ -1662,11 +1644,9 @@ Globals::Globals() {
|
||||
isMultiTargetCompilation = false;
|
||||
errorLimit = -1;
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
enableTimeTrace = false;
|
||||
// set default granularity to 500.
|
||||
timeTraceGranularity = 500;
|
||||
-#endif
|
||||
target = NULL;
|
||||
ctx = new llvm::LLVMContext;
|
||||
|
||||
diff --git a/src/ispc.h b/src/ispc.h
|
||||
index e25d8830e..de357a21c 100644
|
||||
--- a/src/ispc.h
|
||||
+++ b/src/ispc.h
|
||||
@@ -695,13 +695,12 @@ struct Globals {
|
||||
|
||||
/* Number of errors to show in ISPC. */
|
||||
int errorLimit;
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
+
|
||||
/* When true, enable compile time tracing. */
|
||||
bool enableTimeTrace;
|
||||
|
||||
/* When compile time tracing is enabled, set time granularity. */
|
||||
int timeTraceGranularity;
|
||||
-#endif
|
||||
};
|
||||
|
||||
enum {
|
||||
diff --git a/src/ispc_version.h b/src/ispc_version.h
|
||||
index d781347fd..434b2d678 100644
|
||||
--- a/src/ispc_version.h
|
||||
+++ b/src/ispc_version.h
|
||||
@@ -44,13 +44,11 @@
|
||||
|
||||
#define ISPC_LLVM_VERSION (LLVM_VERSION_MAJOR * 10000 + LLVM_VERSION_MINOR * 100)
|
||||
|
||||
-#define ISPC_LLVM_8_0 80000
|
||||
-#define ISPC_LLVM_9_0 90000
|
||||
#define ISPC_LLVM_10_0 100000
|
||||
#define ISPC_LLVM_11_0 110000
|
||||
#define ISPC_LLVM_12_0 120000
|
||||
|
||||
-#define OLDEST_SUPPORTED_LLVM ISPC_LLVM_8_0
|
||||
+#define OLDEST_SUPPORTED_LLVM ISPC_LLVM_10_0
|
||||
#define LATEST_SUPPORTED_LLVM ISPC_LLVM_12_0
|
||||
|
||||
#ifdef __ispc__xstr
|
||||
diff --git a/src/main.cpp b/src/main.cpp
|
||||
index 8f64330cc..5c920eabc 100644
|
||||
--- a/src/main.cpp
|
||||
+++ b/src/main.cpp
|
||||
@@ -55,9 +55,7 @@
|
||||
#include <llvm/Support/Signals.h>
|
||||
#include <llvm/Support/TargetRegistry.h>
|
||||
#include <llvm/Support/TargetSelect.h>
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
#include <llvm/Support/ToolOutputFile.h>
|
||||
-#endif
|
||||
|
||||
#ifdef ISPC_HOST_IS_WINDOWS
|
||||
#define strcasecmp stricmp
|
||||
@@ -181,11 +179,9 @@ static void lPrintVersion() {
|
||||
snprintf(targetHelp, sizeof(targetHelp), "[--target-os=<os>]\t\t\tSelect target OS. <os>={%s}",
|
||||
g->target_registry->getSupportedOSes().c_str());
|
||||
PrintWithWordBreaks(targetHelp, 24, TerminalWidth(), stdout);
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
printf(" [--time-trace]\t\t\tTurn on time profiler. Generates JSON file based on output filename.\n");
|
||||
printf(" [--time-trace-granularity=<value>\tMinimum time granularity (in microseconds) traced by time "
|
||||
"profiler.\n");
|
||||
-#endif
|
||||
printf(" [--version]\t\t\t\tPrint ispc version\n");
|
||||
#ifdef ISPC_GENX_ENABLED
|
||||
printf(" [--vc-options=<\"-option1 -option2...\">]\t\t\t\tPass additional options to Vector Compiler backend\n");
|
||||
@@ -462,7 +458,6 @@ static void setCallingConv(VectorCallStatus vectorCall, Arch arch) {
|
||||
}
|
||||
}
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
static void writeCompileTimeFile(const char *outFileName) {
|
||||
llvm::SmallString<128> jsonFileName(outFileName);
|
||||
jsonFileName.append(".json");
|
||||
@@ -479,7 +474,6 @@ static void writeCompileTimeFile(const char *outFileName) {
|
||||
of->keep();
|
||||
return;
|
||||
}
|
||||
-#endif
|
||||
|
||||
static std::set<int> ParsingPhases(char *stages, ArgErrors &errorHandler) {
|
||||
constexpr int parsing_limit = 100;
|
||||
@@ -791,12 +785,10 @@ int main(int Argc, char *Argv[]) {
|
||||
}
|
||||
} else if (!strncmp(argv[i], "--force-alignment=", 18)) {
|
||||
g->forceAlignment = atoi(argv[i] + 18);
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
} else if (!strcmp(argv[i], "--time-trace")) {
|
||||
g->enableTimeTrace = true;
|
||||
} else if (!strncmp(argv[i], "--time-trace-granularity=", 25)) {
|
||||
g->timeTraceGranularity = atoi(argv[i] + 25);
|
||||
-#endif
|
||||
} else if (!strcmp(argv[i], "--woff") || !strcmp(argv[i], "-woff")) {
|
||||
g->disableWarnings = true;
|
||||
g->emitPerfWarnings = false;
|
||||
@@ -1059,7 +1051,6 @@ int main(int Argc, char *Argv[]) {
|
||||
|
||||
// This needs to happen after the TargetOS is decided.
|
||||
setCallingConv(vectorCall, arch);
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
if (g->enableTimeTrace) {
|
||||
llvm::timeTraceProfilerInitialize(g->timeTraceGranularity, "ispc");
|
||||
}
|
||||
@@ -1077,9 +1068,5 @@ int main(int Argc, char *Argv[]) {
|
||||
}
|
||||
llvm::timeTraceProfilerCleanup();
|
||||
}
|
||||
-#else
|
||||
- int ret = Module::CompileAndOutput(file, arch, cpu, targets, flags, ot, outFileName, headerFileName, depsFileName,
|
||||
- depsTargetName, hostStubFileName, devStubFileName);
|
||||
-#endif
|
||||
return ret;
|
||||
}
|
||||
diff --git a/src/module.cpp b/src/module.cpp
|
||||
index fe7452df1..a85fec77a 100644
|
||||
--- a/src/module.cpp
|
||||
+++ b/src/module.cpp
|
||||
@@ -170,9 +170,7 @@ Module::Module(const char *fn) {
|
||||
module->setDataLayout(g->target->getDataLayout()->getStringRepresentation());
|
||||
|
||||
if (g->generateDebuggingSymbols) {
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope TimeScope("Create Debug Data");
|
||||
-#endif
|
||||
// To enable debug information on Windows, we have to let llvm know, that
|
||||
// debug information should be emitted in CodeView format.
|
||||
if (g->target_os == TargetOS::windows) {
|
||||
@@ -226,10 +224,8 @@ extern YY_BUFFER_STATE yy_create_buffer(FILE *, int);
|
||||
extern void yy_delete_buffer(YY_BUFFER_STATE);
|
||||
|
||||
int Module::CompileFile() {
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope CompileFileTimeScope(
|
||||
"CompileFile", llvm::StringRef(filename + ("_" + std::string(g->target->GetISAString()))));
|
||||
-#endif
|
||||
extern void ParserInit();
|
||||
ParserInit();
|
||||
|
||||
@@ -238,18 +234,14 @@ int Module::CompileFile() {
|
||||
// variable 'm' to be initialized and available (which it isn't until
|
||||
// the Module constructor returns...)
|
||||
{
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope TimeScope("DefineStdlib");
|
||||
-#endif
|
||||
DefineStdlib(symbolTable, g->ctx, module, g->includeStdlib);
|
||||
}
|
||||
|
||||
bool runPreprocessor = g->runCPP;
|
||||
|
||||
if (runPreprocessor) {
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope TimeScope("Frontend parser");
|
||||
-#endif
|
||||
if (!IsStdin(filename)) {
|
||||
// Try to open the file first, since otherwise we crash in the
|
||||
// preprocessor if the file doesn't exist.
|
||||
@@ -268,9 +260,7 @@ int Module::CompileFile() {
|
||||
yyparse();
|
||||
yy_delete_buffer(strbuf);
|
||||
} else {
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope TimeScope("Frontend parser");
|
||||
-#endif
|
||||
// No preprocessor, just open up the file if it's not stdin..
|
||||
FILE *f = NULL;
|
||||
if (IsStdin(filename)) {
|
||||
@@ -297,9 +287,7 @@ int Module::CompileFile() {
|
||||
|
||||
if (diBuilder)
|
||||
diBuilder->finalize();
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope TimeScope("Optimize");
|
||||
-#endif
|
||||
if (errorCount == 0)
|
||||
Optimize(module, g->opt.level);
|
||||
|
||||
@@ -1243,15 +1231,8 @@ bool Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine, llvm:
|
||||
const char *outFileName) {
|
||||
// Figure out if we're generating object file or assembly output, and
|
||||
// set binary output for object files
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- Assert(!g->target->isGenXTarget());
|
||||
- llvm::TargetMachine::CodeGenFileType fileType =
|
||||
- (outputType == Object) ? llvm::TargetMachine::CGFT_ObjectFile : llvm::TargetMachine::CGFT_AssemblyFile;
|
||||
- bool binary = (fileType == llvm::TargetMachine::CGFT_ObjectFile);
|
||||
-#else // LLVM 10.0+
|
||||
llvm::CodeGenFileType fileType = (outputType == Object) ? llvm::CGFT_ObjectFile : llvm::CGFT_AssemblyFile;
|
||||
bool binary = (fileType == llvm::CGFT_ObjectFile);
|
||||
-#endif
|
||||
|
||||
llvm::sys::fs::OpenFlags flags = binary ? llvm::sys::fs::F_None : llvm::sys::fs::F_Text;
|
||||
|
||||
@@ -2219,11 +2200,7 @@ void Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *
|
||||
inst.setTarget(target);
|
||||
inst.createSourceManager(inst.getFileManager());
|
||||
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- clang::FrontendInputFile inputFile(infilename, clang::InputKind::Unknown);
|
||||
-#else // LLVM 10.0+
|
||||
clang::FrontendInputFile inputFile(infilename, clang::InputKind());
|
||||
-#endif
|
||||
|
||||
inst.InitializeSourceManager(inputFile);
|
||||
|
||||
@@ -2722,9 +2699,7 @@ int Module::CompileAndOutput(const char *srcFile, Arch arch, const char *cpu, st
|
||||
|
||||
m = new Module(srcFile);
|
||||
if (m->CompileFile() == 0) {
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope TimeScope("Backend");
|
||||
-#endif
|
||||
#ifdef ISPC_GENX_ENABLED
|
||||
if (outputType == Asm || outputType == Object) {
|
||||
if (g->target->isGenXTarget()) {
|
||||
@@ -2855,9 +2830,7 @@ int Module::CompileAndOutput(const char *srcFile, Arch arch, const char *cpu, st
|
||||
|
||||
m = new Module(srcFile);
|
||||
int compileFileError = m->CompileFile();
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope TimeScope("Backend");
|
||||
-#endif
|
||||
if (compileFileError == 0) {
|
||||
// Create the dispatch module, unless already created;
|
||||
// in the latter case, just do the checking
|
||||
diff --git a/src/module.h b/src/module.h
|
||||
index 61d3cfea0..603124d50 100644
|
||||
--- a/src/module.h
|
||||
+++ b/src/module.h
|
||||
@@ -43,9 +43,7 @@
|
||||
|
||||
#include <llvm/IR/DebugInfo.h>
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
#include <llvm/Support/TimeProfiler.h>
|
||||
-#endif
|
||||
|
||||
#ifdef ISPC_GENX_ENABLED
|
||||
#include "ocl_igc_interface/igc_ocl_device_ctx.h"
|
||||
diff --git a/src/opt.cpp b/src/opt.cpp
|
||||
index a655a8344..5b1ac7b63 100644
|
||||
--- a/src/opt.cpp
|
||||
+++ b/src/opt.cpp
|
||||
@@ -66,6 +66,7 @@
|
||||
#include <llvm/IR/Instructions.h>
|
||||
#include <llvm/IR/IntrinsicInst.h>
|
||||
#include <llvm/IR/Intrinsics.h>
|
||||
+#include <llvm/IR/IntrinsicsX86.h>
|
||||
#include <llvm/IR/LegacyPassManager.h>
|
||||
#include <llvm/IR/Module.h>
|
||||
#include <llvm/IR/PatternMatch.h>
|
||||
@@ -85,9 +86,6 @@
|
||||
#include <llvm/Transforms/Scalar/InstSimplifyPass.h>
|
||||
#include <llvm/Transforms/Utils.h>
|
||||
#include <llvm/Transforms/Utils/BasicBlockUtils.h>
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
-#include <llvm/IR/IntrinsicsX86.h>
|
||||
-#endif
|
||||
|
||||
#ifdef ISPC_HOST_IS_LINUX
|
||||
#include <alloca.h>
|
||||
@@ -1003,10 +1001,7 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
else
|
||||
align = callInst->getCalledFunction() == avxMaskedLoad32 ? 4 : 8;
|
||||
name = LLVMGetName(callInst->getArgOperand(0), "_load");
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- llvm::Instruction *loadInst =
|
||||
- new llvm::LoadInst(castPtr, name, false /* not volatile */, align, (llvm::Instruction *)NULL);
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_10_0
|
||||
+#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
|
||||
llvm::Instruction *loadInst = new llvm::LoadInst(castPtr, name, false /* not volatile */,
|
||||
llvm::MaybeAlign(align), (llvm::Instruction *)NULL);
|
||||
#else
|
||||
@@ -1043,13 +1038,8 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
align = g->target->getNativeVectorAlignment();
|
||||
else
|
||||
align = callInst->getCalledFunction() == avxMaskedStore32 ? 4 : 8;
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- llvm::StoreInst *storeInst = new llvm::StoreInst(rvalue, castPtr, (llvm::Instruction *)NULL);
|
||||
- storeInst->setAlignment(align);
|
||||
-#else
|
||||
llvm::StoreInst *storeInst = new llvm::StoreInst(rvalue, castPtr, (llvm::Instruction *)NULL,
|
||||
llvm::MaybeAlign(align).valueOrOne());
|
||||
-#endif
|
||||
lCopyMetadata(storeInst, callInst);
|
||||
llvm::ReplaceInstWithInst(callInst, storeInst);
|
||||
|
||||
@@ -1066,9 +1056,7 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
bool IntrinsicsOpt::runOnFunction(llvm::Function &F) {
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("IntrinsicsOpt::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -1239,9 +1227,7 @@ bool InstructionSimplifyPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
bool InstructionSimplifyPass::runOnFunction(llvm::Function &F) {
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("InstructionSimplifyPass::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -2974,16 +2960,10 @@ static bool lImproveMaskedStore(llvm::CallInst *callInst) {
|
||||
|
||||
lvalue = new llvm::BitCastInst(lvalue, ptrType, "lvalue_to_ptr_type", callInst);
|
||||
lCopyMetadata(lvalue, callInst);
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- store =
|
||||
- new llvm::StoreInst(rvalue, lvalue, false /* not volatile */,
|
||||
- g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align);
|
||||
-#else
|
||||
store = new llvm::StoreInst(
|
||||
rvalue, lvalue, false /* not volatile */,
|
||||
llvm::MaybeAlign(g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align)
|
||||
.valueOrOne());
|
||||
-#endif
|
||||
}
|
||||
if (store != NULL) {
|
||||
lCopyMetadata(store, callInst);
|
||||
@@ -3059,11 +3039,7 @@ static bool lImproveMaskedLoad(llvm::CallInst *callInst, llvm::BasicBlock::itera
|
||||
{
|
||||
llvm::Type *ptrType = llvm::PointerType::get(callInst->getType(), 0);
|
||||
ptr = new llvm::BitCastInst(ptr, ptrType, "ptr_cast_for_load", callInst);
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- load = new llvm::LoadInst(ptr, callInst->getName(), false /* not volatile */,
|
||||
- g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align,
|
||||
- (llvm::Instruction *)NULL);
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_10_0
|
||||
+#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
|
||||
load = new llvm::LoadInst(
|
||||
ptr, callInst->getName(), false /* not volatile */,
|
||||
llvm::MaybeAlign(g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align)
|
||||
@@ -3129,9 +3105,7 @@ bool ImproveMemoryOpsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
bool ImproveMemoryOpsPass::runOnFunction(llvm::Function &F) {
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("ImproveMemoryOpsPass::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -3424,9 +3398,7 @@ llvm::Value *lGEPAndLoad(llvm::Value *basePtr, int64_t offset, int align, llvm::
|
||||
llvm::Type *type) {
|
||||
llvm::Value *ptr = lGEPInst(basePtr, LLVMInt64(offset), "new_base", insertBefore);
|
||||
ptr = new llvm::BitCastInst(ptr, llvm::PointerType::get(type, 0), "ptr_cast", insertBefore);
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- return new llvm::LoadInst(ptr, "gather_load", false /* not volatile */, align, insertBefore);
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_10_0
|
||||
+#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
|
||||
return new llvm::LoadInst(ptr, "gather_load", false /* not volatile */, llvm::MaybeAlign(align), insertBefore);
|
||||
#else // LLVM 11.0+
|
||||
return new llvm::LoadInst(llvm::dyn_cast<llvm::PointerType>(ptr->getType())->getPointerElementType(), ptr,
|
||||
@@ -4135,9 +4107,7 @@ bool GatherCoalescePass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
bool GatherCoalescePass::runOnFunction(llvm::Function &F) {
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("GatherCoalescePass::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -4467,9 +4437,7 @@ bool ReplacePseudoMemoryOpsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
bool ReplacePseudoMemoryOpsPass::runOnFunction(llvm::Function &F) {
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("ReplacePseudoMemoryOpsPass::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -4573,9 +4541,7 @@ bool IsCompileTimeConstantPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
bool IsCompileTimeConstantPass::runOnFunction(llvm::Function &F) {
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("IsCompileTimeConstantPass::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -5201,9 +5167,7 @@ bool PeepholePass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
bool PeepholePass::runOnFunction(llvm::Function &F) {
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("PeepholePass::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -5299,9 +5263,7 @@ bool ReplaceStdlibShiftPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
bool ReplaceStdlibShiftPass::runOnFunction(llvm::Function &F) {
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("ReplaceStdlibShiftPass::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -5399,9 +5361,7 @@ llvm::Instruction *FixBooleanSelectPass::fixSelect(llvm::SelectInst *sel, llvm::
|
||||
}
|
||||
|
||||
bool FixBooleanSelectPass::runOnFunction(llvm::Function &F) {
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("FixBooleanSelectPass::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
|
||||
return modifiedAny;
|
||||
@@ -5964,9 +5924,7 @@ bool GenXGatherCoalescing::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
}
|
||||
|
||||
bool GenXGatherCoalescing::runOnFunction(llvm::Function &F) {
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("GenXGatherCoalescing::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -6113,9 +6071,7 @@ bool PromoteToPrivateMemoryPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
bool PromoteToPrivateMemoryPass::runOnFunction(llvm::Function &F) {
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("PromoteToPrivateMemoryPass::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -6181,9 +6137,7 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
bool ReplaceLLVMIntrinsics::runOnFunction(llvm::Function &F) {
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("ReplaceLLVMIntrinsics::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -6278,9 +6232,7 @@ bool ReplaceUnsupportedInsts::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
bool ReplaceUnsupportedInsts::runOnFunction(llvm::Function &F) {
|
||||
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("ReplaceUnsupportedInsts::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -6369,9 +6321,7 @@ bool CheckUnsupportedInsts::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
}
|
||||
|
||||
bool CheckUnsupportedInsts::runOnFunction(llvm::Function &F) {
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("CheckUnsupportedInsts::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -6440,9 +6390,7 @@ bool MangleOpenCLBuiltins::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
}
|
||||
|
||||
bool MangleOpenCLBuiltins::runOnFunction(llvm::Function &F) {
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("MangleOpenCLBuiltins::runOnFunction", F.getName());
|
||||
-#endif
|
||||
bool modifiedAny = false;
|
||||
for (llvm::BasicBlock &BB : F) {
|
||||
modifiedAny |= runOnBasicBlock(BB);
|
||||
@@ -6828,9 +6776,7 @@ bool FixAddressSpace::runOnFunction(llvm::Function &F) {
|
||||
// Transformations are correct when the function is not internal.
|
||||
// This is due to address space calculation algorithm.
|
||||
// TODO: problems can be met in case of Stack Calls
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("FixAddressSpace::runOnFunction", F.getName());
|
||||
-#endif
|
||||
if (F.getLinkage() == llvm::GlobalValue::LinkageTypes::InternalLinkage)
|
||||
return false;
|
||||
|
||||
@@ -6854,9 +6800,7 @@ class DemotePHIs : public llvm::FunctionPass {
|
||||
char DemotePHIs::ID = 0;
|
||||
|
||||
bool DemotePHIs::runOnFunction(llvm::Function &F) {
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
|
||||
llvm::TimeTraceScope FuncScope("DemotePHIs::runOnFunction", F.getName());
|
||||
-#endif
|
||||
if (F.isDeclaration() || skipFunction(F))
|
||||
return false;
|
||||
std::vector<llvm::Instruction *> WorkList;
|
||||
diff --git a/src/type.cpp b/src/type.cpp
|
||||
index 688a4e874..fa0cb04db 100644
|
||||
--- a/src/type.cpp
|
||||
+++ b/src/type.cpp
|
||||
@@ -1822,14 +1822,10 @@ llvm::DIType *StructType::GetDIType(llvm::DIScope *scope) const {
|
||||
llvm::DIFile *diFile = pos.GetDIFile();
|
||||
llvm::DINamespace *diSpace = pos.GetDINamespace();
|
||||
return m->diBuilder->createStructType(diSpace, GetString(), diFile,
|
||||
- pos.first_line, // Line number
|
||||
- layout->getSizeInBits(), // Size in bits
|
||||
-#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
|
||||
- layout->getAlignment() * 8, // Alignment in bits
|
||||
-#else // LLVM 10.0+
|
||||
+ pos.first_line, // Line number
|
||||
+ layout->getSizeInBits(), // Size in bits
|
||||
layout->getAlignment().value() * 8, // Alignment in bits
|
||||
-#endif
|
||||
- llvm::DINode::FlagZero, // Flags
|
||||
+ llvm::DINode::FlagZero, // Flags
|
||||
NULL, elements);
|
||||
}
|
||||
|
||||
diff --git a/tests/lit-tests/1771.ispc b/tests/lit-tests/1771.ispc
|
||||
index 98064d84d..4feb73dd7 100644
|
||||
--- a/tests/lit-tests/1771.ispc
|
||||
+++ b/tests/lit-tests/1771.ispc
|
||||
@@ -5,7 +5,6 @@
|
||||
// RUN: %{ispc} %s --target=sse4-i16x8 --emit-asm -o - | FileCheck %s -check-prefix=CHECKSSE4_I16X8
|
||||
// RUN: %{ispc} %s --target=sse4-i8x16 --emit-asm -o - | FileCheck %s -check-prefix=CHECKSSE4_I8X16
|
||||
|
||||
-// REQUIRES: LLVM_10_0+
|
||||
// REQUIRES: X86_ENABLED
|
||||
|
||||
// CHECKAVX2_I32X8: {{[a-z]*xor[a-z]*}} %xmm0, %xmm0, %xmm0
|
||||
diff --git a/tests/lit-tests/1844.ispc b/tests/lit-tests/1844.ispc
|
||||
index 793a8866c..189edf4c3 100644
|
||||
--- a/tests/lit-tests/1844.ispc
|
||||
+++ b/tests/lit-tests/1844.ispc
|
||||
@@ -6,9 +6,6 @@
|
||||
|
||||
// REQUIRES: X86_ENABLED
|
||||
|
||||
-// It doesn't work for anything earlier than 10.0, but it will not be fixed, so don't run.
|
||||
-// REQUIRES: LLVM_10_0+
|
||||
-
|
||||
extern uniform unsigned int64 var_6;
|
||||
extern uniform unsigned int16 var_11;
|
||||
extern uniform bool arr_201 [1] [15] [20];
|
||||
diff --git a/tests/lit-tests/1926.ispc b/tests/lit-tests/1926.ispc
|
||||
index 70f7cc3c2..7921c91a6 100644
|
||||
--- a/tests/lit-tests/1926.ispc
|
||||
+++ b/tests/lit-tests/1926.ispc
|
||||
@@ -2,8 +2,6 @@
|
||||
// RUN: cat %T/1926.o.json \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
-// REQUIRES: LLVM_10_0+
|
||||
-
|
||||
// CHECK: "traceEvents"
|
||||
// CHECK: "detail"
|
||||
export uniform int foo(uniform int a[], uniform int count) {
|
||||
diff --git a/tests/lit-tests/cpus_x86.ispc b/tests/lit-tests/cpus_x86.ispc
|
||||
index 516efdd4c..4d60186f6 100644
|
||||
--- a/tests/lit-tests/cpus_x86.ispc
|
||||
+++ b/tests/lit-tests/cpus_x86.ispc
|
||||
@@ -24,6 +24,8 @@
|
||||
//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=icl
|
||||
//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=icelake-server
|
||||
//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=icx
|
||||
+//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tigerlake
|
||||
+//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tgl
|
||||
|
||||
// REQUIRES: X86_ENABLED
|
||||
|
||||
diff --git a/tests/lit-tests/cpus_x86_llvm10.ispc b/tests/lit-tests/cpus_x86_llvm10.ispc
|
||||
deleted file mode 100644
|
||||
index ef00000e5..000000000
|
||||
--- a/tests/lit-tests/cpus_x86_llvm10.ispc
|
||||
+++ /dev/null
|
||||
@@ -1,11 +0,0 @@
|
||||
-// The test checks that cpu definitions (including all synonyms) are successfully consumed by compiler.
|
||||
-
|
||||
-//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tigerlake
|
||||
-//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tgl
|
||||
-
|
||||
-// REQUIRES: X86_ENABLED
|
||||
-// REQUIRES: LLVM_10_0+
|
||||
-
|
||||
-uniform int i;
|
||||
-
|
||||
-void foo() {}
|
||||
diff --git a/tests/lit-tests/lit.cfg b/tests/lit-tests/lit.cfg
|
||||
index 17016579d..045e69437 100644
|
||||
--- a/tests/lit-tests/lit.cfg
|
||||
+++ b/tests/lit-tests/lit.cfg
|
||||
@@ -30,11 +30,6 @@ print("Config:")
|
||||
|
||||
# LLVM version
|
||||
llvm_version = LooseVersion(ispc_llvm_version_number)
|
||||
-if llvm_version >= LooseVersion("10.0.0"):
|
||||
- print("LLVM_10_0+: YES")
|
||||
- config.available_features.add("LLVM_10_0+")
|
||||
-else:
|
||||
- print("LLVM_10_0+: NO")
|
||||
|
||||
if llvm_version >= LooseVersion("12.0.0"):
|
||||
print("LLVM_12_0+: YES")
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,34 @@
|
|||
From c03a5142444476a1caa5c2ba7fa2d92d7793d6f1 Mon Sep 17 00:00:00 2001
|
||||
From: Deepak Rajendrakumaran <deepak.rajendrakumaran@intel.com>
|
||||
Date: Mon, 25 Jan 2021 09:22:49 -0800
|
||||
Subject: [PATCH] Fixing build on llvm trunk.
|
||||
|
||||
---
|
||||
src/ctx.cpp | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/ctx.cpp b/src/ctx.cpp
|
||||
index ded524b71..b60e6fe84 100644
|
||||
--- a/src/ctx.cpp
|
||||
+++ b/src/ctx.cpp
|
||||
@@ -1020,8 +1020,7 @@ void FunctionEmitContext::EmitCaseLabel(int value, bool checkMask, SourcePos pos
|
||||
llvm::BasicBlock *bbCaseImpl = NULL;
|
||||
if (emitGenXHardwareMask()) {
|
||||
// Create basic block with actual case implementation
|
||||
- llvm::Twine bbName = llvm::Twine(bbCase->getName()) + "_impl";
|
||||
- bbCaseImpl = CreateBasicBlock(bbName, bbCase);
|
||||
+ bbCaseImpl = CreateBasicBlock(llvm::Twine(bbCase->getName()) + "_impl", bbCase);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3142,8 +3141,8 @@ llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vec
|
||||
llvm::Value *undef2 = llvm::UndefValue::get(vecType);
|
||||
|
||||
// InsertElement
|
||||
- llvm::Twine tw = name.isTriviallyEmpty() ? (llvm::Twine(v->getName()) + "_broadcast") : name + llvm::Twine("_init");
|
||||
- llvm::Value *insert = InsertInst(undef1, v, 0, tw.str().c_str());
|
||||
+ llvm::Value *insert =
|
||||
+ InsertInst(undef1, v, 0, name.isTriviallyEmpty() ? (llvm::Twine(v->getName()) + "_broadcast") : name + "_init");
|
||||
|
||||
// ShuffleVector
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
|
@ -0,0 +1,372 @@
|
|||
From c1d0a51bf8416d42144de9e2bdd59825eaeff1ac Mon Sep 17 00:00:00 2001
|
||||
From: Arina Neshlyaeva <arina.neshlyaeva@intel.com>
|
||||
Date: Fri, 8 Jan 2021 14:13:49 -0800
|
||||
Subject: [PATCH] LLVM 11 support for gen code
|
||||
|
||||
---
|
||||
src/ctx.cpp | 13 ++-
|
||||
src/gen/GlobalsLocalization.cpp | 9 +-
|
||||
src/opt.cpp | 143 ++++++++++++++++++++++++--------
|
||||
3 files changed, 124 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/src/ctx.cpp b/src/ctx.cpp
|
||||
index b60e6fe84..2a72e6837 100644
|
||||
--- a/src/ctx.cpp
|
||||
+++ b/src/ctx.cpp
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- Copyright (c) 2010-2020, Intel Corporation
|
||||
+ Copyright (c) 2010-2021, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -3685,8 +3685,17 @@ llvm::Value *FunctionEmitContext::GenXSimdCFPredicate(llvm::Value *value, llvm::
|
||||
AssertPos(currentPos, llvm::isa<llvm::VectorType>(value->getType()));
|
||||
llvm::VectorType *vt = llvm::dyn_cast<llvm::VectorType>(value->getType());
|
||||
if (defaults == NULL) {
|
||||
- defaults = llvm::ConstantVector::getSplat(value->getType()->getVectorNumElements(),
|
||||
+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
+ defaults = llvm::ConstantVector::getSplat(vt->getVectorNumElements(),
|
||||
+ llvm::Constant::getNullValue(vt->getElementType()));
|
||||
+#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+ defaults = llvm::ConstantVector::getSplat({static_cast<unsigned int>(vt->getNumElements()), false},
|
||||
llvm::Constant::getNullValue(vt->getElementType()));
|
||||
+#else
|
||||
+ defaults = llvm::ConstantVector::getSplat(
|
||||
+ llvm::ElementCount::get(static_cast<unsigned int>(vt->getNumElements()), false),
|
||||
+ llvm::Constant::getNullValue(vt->getElementType()));
|
||||
+#endif
|
||||
}
|
||||
|
||||
auto Fn = llvm::GenXIntrinsic::getGenXDeclaration(m->module, llvm::GenXIntrinsic::genx_simdcf_predicate,
|
||||
diff --git a/src/gen/GlobalsLocalization.cpp b/src/gen/GlobalsLocalization.cpp
|
||||
index a176e9462..41f3b00e2 100644
|
||||
--- a/src/gen/GlobalsLocalization.cpp
|
||||
+++ b/src/gen/GlobalsLocalization.cpp
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- Copyright (c) 2014, 2016-2020, Intel Corporation
|
||||
+ Copyright (c) 2014, 2016-2021, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -53,8 +53,10 @@
|
||||
#include <llvm/GenXIntrinsics/GenXIntrOpts.h>
|
||||
#include <llvm/GenXIntrinsics/GenXIntrinsics.h>
|
||||
#include <llvm/GenXIntrinsics/GenXMetadata.h>
|
||||
-#include <llvm/IR/CFG.h>
|
||||
+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
#include <llvm/IR/CallSite.h>
|
||||
+#endif
|
||||
+#include <llvm/IR/CFG.h>
|
||||
#include <llvm/IR/DebugInfo.h>
|
||||
#include <llvm/IR/Dominators.h>
|
||||
#include <llvm/IR/Function.h>
|
||||
@@ -470,7 +472,8 @@ void GlobalsLocalization::LocalizeGlobals(LocalizationInfo &LI) {
|
||||
Instruction &FirstI = *Fn->getEntryBlock().begin();
|
||||
Type *ElemTy = GV->getType()->getElementType();
|
||||
AllocaInst *Alloca = new AllocaInst(ElemTy, 0, GV->getName() + ".local", &FirstI);
|
||||
- Alloca->setAlignment(llvm::MaybeAlign(GV->getAlignment()));
|
||||
+ Alloca->setAlignment(llvm::MaybeAlign(GV->getAlignment()).valueOrOne());
|
||||
+
|
||||
if (!isa<UndefValue>(GV->getInitializer()))
|
||||
new StoreInst(GV->getInitializer(), Alloca, &FirstI);
|
||||
|
||||
diff --git a/src/opt.cpp b/src/opt.cpp
|
||||
index d58d77f73..1789b8476 100644
|
||||
--- a/src/opt.cpp
|
||||
+++ b/src/opt.cpp
|
||||
@@ -2899,15 +2899,17 @@ static llvm::Function *lGenXMaskedInt8Inst(llvm::Instruction *inst, bool isStore
|
||||
static llvm::CallInst *lGenXStoreInst(llvm::Value *val, llvm::Value *ptr, llvm::Instruction *inst) {
|
||||
Assert(g->target->isGenXTarget());
|
||||
Assert(llvm::isa<llvm::VectorType>(val->getType()));
|
||||
- Assert(llvm::isPowerOf2_32(val->getType()->getVectorNumElements()));
|
||||
- Assert(val->getType()->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
|
||||
+
|
||||
+ llvm::VectorType *valVecType = llvm::dyn_cast<llvm::VectorType>(val->getType());
|
||||
+ Assert(llvm::isPowerOf2_32(valVecType->getNumElements()));
|
||||
+ Assert(valVecType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
|
||||
|
||||
// The data write of svm store must have a size that is a power of two from 16 to 128
|
||||
// bytes. However for int8 type and simd width = 8, the data write size is 8.
|
||||
// So we use masked store function here instead of svm store which process int8 type
|
||||
// correctly.
|
||||
- if (val->getType()->getPrimitiveSizeInBits() / 8 < 16) {
|
||||
- Assert(val->getType()->getScalarType() == LLVMTypes::Int8Type);
|
||||
+ if (valVecType->getPrimitiveSizeInBits() / 8 < 16) {
|
||||
+ Assert(valVecType->getScalarType() == LLVMTypes::Int8Type);
|
||||
if (llvm::Function *maskedFunc = lGenXMaskedInt8Inst(inst, true))
|
||||
return llvm::dyn_cast<llvm::CallInst>(lCallInst(maskedFunc, ptr, val, LLVMMaskAllOn, ""));
|
||||
else {
|
||||
@@ -2923,15 +2925,17 @@ static llvm::CallInst *lGenXStoreInst(llvm::Value *val, llvm::Value *ptr, llvm::
|
||||
|
||||
static llvm::CallInst *lGenXLoadInst(llvm::Value *ptr, llvm::Type *retType, llvm::Instruction *inst) {
|
||||
Assert(llvm::isa<llvm::VectorType>(retType));
|
||||
- Assert(llvm::isPowerOf2_32(retType->getVectorNumElements()));
|
||||
- Assert(retType->getPrimitiveSizeInBits());
|
||||
- Assert(retType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
|
||||
+
|
||||
+ llvm::VectorType *retVecType = llvm::dyn_cast<llvm::VectorType>(retType);
|
||||
+ Assert(llvm::isPowerOf2_32(retVecType->getNumElements()));
|
||||
+ Assert(retVecType->getPrimitiveSizeInBits());
|
||||
+ Assert(retVecType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
|
||||
// The data read of svm load must have a size that is a power of two from 16 to 128
|
||||
// bytes. However for int8 type and simd width = 8, the data read size is 8.
|
||||
// So we use masked load function here instead of svm load which process int8 type
|
||||
// correctly.
|
||||
- if (retType->getPrimitiveSizeInBits() / 8 < 16) {
|
||||
- Assert(retType->getScalarType() == LLVMTypes::Int8Type);
|
||||
+ if (retVecType->getPrimitiveSizeInBits() / 8 < 16) {
|
||||
+ Assert(retVecType->getScalarType() == LLVMTypes::Int8Type);
|
||||
if (llvm::Function *maskedFunc = lGenXMaskedInt8Inst(inst, false))
|
||||
return llvm::dyn_cast<llvm::CallInst>(lCallInst(maskedFunc, ptr, LLVMMaskAllOn, ""));
|
||||
else {
|
||||
@@ -5622,15 +5626,24 @@ static bool lVectorizeGEPs(llvm::Value *ptr, std::vector<PtrUse> &ptrUses, std::
|
||||
llvm::PtrToIntInst *ptrToInt =
|
||||
new llvm::PtrToIntInst(ptr, LLVMTypes::Int64Type, "vectorized_ptrtoint", insertBefore);
|
||||
llvm::Instruction *addr = llvm::BinaryOperator::CreateAdd(ptrToInt, offset, "vectorized_address", insertBefore);
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ llvm::Type *retType = llvm::FixedVectorType::get(scalar_type, reqSize / t_size);
|
||||
+#else
|
||||
llvm::Type *retType = llvm::VectorType::get(scalar_type, reqSize / t_size);
|
||||
+#endif
|
||||
llvm::Function *fn = llvm::GenXIntrinsic::getGenXDeclaration(
|
||||
m->module, llvm::GenXIntrinsic::genx_svm_block_ld_unaligned, {retType, addr->getType()});
|
||||
llvm::Instruction *ld = llvm::CallInst::Create(fn, {addr}, "vectorized_ld", insertBefore);
|
||||
|
||||
if (loadingPtr) {
|
||||
// Cast int to ptr via inttoptr
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ ld = new llvm::IntToPtrInst(ld, llvm::FixedVectorType::get(originalType, reqSize / t_size),
|
||||
+ "vectorized_inttoptr", insertBefore);
|
||||
+#else
|
||||
ld = new llvm::IntToPtrInst(ld, llvm::VectorType::get(originalType, reqSize / t_size),
|
||||
"vectorized_inttoptr", insertBefore);
|
||||
+#endif
|
||||
}
|
||||
|
||||
// Scalar extracts for all loaded elements
|
||||
@@ -6160,19 +6173,34 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
llvm::Instruction *inst = &*I;
|
||||
if (llvm::CallInst *ci = llvm::dyn_cast<llvm::CallInst>(inst)) {
|
||||
llvm::Function *func = ci->getCalledFunction();
|
||||
- if (func && func->getName() == "llvm.trap") {
|
||||
+ if (func && func->getName().equals("llvm.trap")) {
|
||||
llvm::Type *argTypes[] = {LLVMTypes::Int1VectorType, LLVMTypes::Int16VectorType};
|
||||
// Description of parameters for genx_raw_send_noresult can be found in target-genx.ll
|
||||
auto Fn = +llvm::GenXIntrinsic::getGenXDeclaration(
|
||||
m->module, llvm::GenXIntrinsic::genx_raw_send_noresult, argTypes);
|
||||
llvm::SmallVector<llvm::Value *, 8> Args;
|
||||
Args.push_back(llvm::ConstantInt::get(LLVMTypes::Int32Type, 0));
|
||||
- Args.push_back(llvm::ConstantVector::getSplat(g->target->getNativeVectorWidth(),
|
||||
- llvm::ConstantInt::getTrue(*g->ctx)));
|
||||
+ Args.push_back(llvm::ConstantVector::getSplat(
|
||||
+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
+ g->target->getNativeVectorWidth(),
|
||||
+#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+ {static_cast<unsigned int>(g->target->getNativeVectorWidth()), false},
|
||||
+#else // LLVM 12.0+
|
||||
+ llvm::ElementCount::get(static_cast<unsigned int>(g->target->getNativeVectorWidth()), false),
|
||||
+#endif
|
||||
+ llvm::ConstantInt::getTrue(*g->ctx)));
|
||||
+
|
||||
Args.push_back(llvm::ConstantInt::get(LLVMTypes::Int32Type, 39));
|
||||
Args.push_back(llvm::ConstantInt::get(LLVMTypes::Int32Type, 33554448));
|
||||
llvm::Value *zeroMask = llvm::ConstantVector::getSplat(
|
||||
- g->target->getNativeVectorWidth(), llvm::Constant::getNullValue(llvm::Type::getInt16Ty(*g->ctx)));
|
||||
+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
+ g->target->getNativeVectorWidth(),
|
||||
+#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+ {static_cast<unsigned int>(g->target->getNativeVectorWidth()), false},
|
||||
+#else // LLVM 12.0+
|
||||
+ llvm::ElementCount::get(static_cast<unsigned int>(g->target->getNativeVectorWidth()), false),
|
||||
+#endif
|
||||
+ llvm::Constant::getNullValue(llvm::Type::getInt16Ty(*g->ctx)));
|
||||
Args.push_back(zeroMask);
|
||||
|
||||
llvm::Instruction *newInst = llvm::CallInst::Create(Fn, Args, ci->getName());
|
||||
@@ -6181,7 +6209,7 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
modifiedAny = true;
|
||||
goto restart;
|
||||
}
|
||||
- } else if (func && func->getName() == "llvm.assume") {
|
||||
+ } else if (func && func->getName().equals("llvm.assume")) {
|
||||
ci->eraseFromParent();
|
||||
modifiedAny = true;
|
||||
goto restart;
|
||||
@@ -6335,7 +6363,7 @@ bool CheckUnsupportedInsts::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
continue;
|
||||
for (int i = 0; i < unsupportedFuncs.size(); i++) {
|
||||
std::smatch match;
|
||||
- std::string funcName = func->getName();
|
||||
+ std::string funcName = func->getName().str();
|
||||
if (std::regex_match(funcName, match, unsupportedFuncs[i])) {
|
||||
// We found unsupported function. Generate error and stop compilation.
|
||||
SourcePos pos;
|
||||
@@ -6418,12 +6446,14 @@ bool MangleOpenCLBuiltins::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
if (func->getName().startswith("__spirv_ocl")) {
|
||||
std::string mangledName;
|
||||
llvm::Type *retType = func->getReturnType();
|
||||
- std::string funcName = func->getName();
|
||||
+ std::string funcName = func->getName().str();
|
||||
std::vector<llvm::Type *> ArgTy;
|
||||
// spirv OpenCL builtins are used for double types only
|
||||
- Assert(retType->isVectorTy() && retType->getVectorElementType()->isDoubleTy() ||
|
||||
+ Assert(retType->isVectorTy() &&
|
||||
+ llvm::dyn_cast<llvm::VectorType>(retType)->getElementType()->isDoubleTy() ||
|
||||
retType->isSingleValueType() && retType->isDoubleTy());
|
||||
- if (retType->isVectorTy() && retType->getVectorElementType()->isDoubleTy()) {
|
||||
+ if (retType->isVectorTy() &&
|
||||
+ llvm::dyn_cast<llvm::VectorType>(retType)->getElementType()->isDoubleTy()) {
|
||||
ArgTy.push_back(LLVMTypes::DoubleVectorType);
|
||||
// _DvWIDTH suffix is used in target file to differentiate scalar
|
||||
// and vector versions of intrinsics. Here we remove this
|
||||
@@ -6511,8 +6541,15 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
|
||||
|
||||
// Cast offsets to int64
|
||||
Offsets = new llvm::ZExtInst(
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ Offsets,
|
||||
+ llvm::FixedVectorType::get(LLVMTypes::Int64Type,
|
||||
+ llvm::dyn_cast<llvm::VectorType>(Offsets->getType())->getNumElements()),
|
||||
+ "svm_offset_zext", InsertBefore);
|
||||
+#else
|
||||
Offsets, llvm::VectorType::get(LLVMTypes::Int64Type, Offsets->getType()->getVectorNumElements()),
|
||||
"svm_offset_zext", InsertBefore);
|
||||
+#endif
|
||||
|
||||
if (!llvm::isa<llvm::ConstantPointerNull>(Ptr)) {
|
||||
// Cast ptr to int64
|
||||
@@ -6520,13 +6557,31 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
|
||||
|
||||
// Vectorize ptr
|
||||
llvm::Value *undefInsertValue =
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ llvm::UndefValue::get(llvm::FixedVectorType::get(
|
||||
+ LLVMTypes::Int64Type, llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements()));
|
||||
+#else
|
||||
llvm::UndefValue::get(llvm::VectorType::get(LLVMTypes::Int64Type, addressType->getVectorNumElements()));
|
||||
+#endif
|
||||
address = llvm::InsertElementInst::Create(undefInsertValue, address, LLVMInt32(0), "svm_ptr_iei", InsertBefore);
|
||||
llvm::Constant *zeroVec = llvm::ConstantVector::getSplat(
|
||||
+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
addressType->getVectorNumElements(),
|
||||
+#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+ {llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements(), false},
|
||||
+#else
|
||||
+ llvm::ElementCount::get(
|
||||
+ llvm::dyn_cast<llvm::FixedVectorType>(addressType->getNumElements(), false),
|
||||
+#endif
|
||||
llvm::Constant::getNullValue(llvm::Type::getInt32Ty(InsertBefore->getContext())));
|
||||
+
|
||||
llvm::Value *undefShuffleValue =
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ llvm::UndefValue::get(llvm::FixedVectorType::get(
|
||||
+ LLVMTypes::Int64Type, llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements()));
|
||||
+#else
|
||||
llvm::UndefValue::get(llvm::VectorType::get(LLVMTypes::Int64Type, addressType->getVectorNumElements()));
|
||||
+#endif
|
||||
address = new llvm::ShuffleVectorInst(address, undefShuffleValue, zeroVec, "svm_ptr_svi", InsertBefore);
|
||||
|
||||
// Calculate address
|
||||
@@ -6553,9 +6608,12 @@ llvm::Instruction *FixAddressSpace::processVectorLoad(llvm::LoadInst *LI) {
|
||||
if (retType->getScalarType()->isPointerTy()) {
|
||||
isPtrLoad = true;
|
||||
auto scalarType = g->target->is32Bit() ? LLVMTypes::Int32Type : LLVMTypes::Int64Type;
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ retType = llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::VectorType>(retType)->getNumElements());
|
||||
+#else
|
||||
retType = llvm::VectorType::get(scalarType, retType->getVectorNumElements());
|
||||
+#endif
|
||||
}
|
||||
-
|
||||
llvm::Instruction *res = lGenXLoadInst(ptr, retType, llvm::dyn_cast<llvm::Instruction>(LI));
|
||||
Assert(res);
|
||||
|
||||
@@ -6580,11 +6638,16 @@ llvm::Instruction *FixAddressSpace::processSVMVectorLoad(llvm::Instruction *CI)
|
||||
ptr = new llvm::IntToPtrInst(ptr, llvm::PointerType::get(retType, 0), CI->getName() + "_inttoptr", CI);
|
||||
llvm::Instruction *loadInst = NULL;
|
||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
- loadInst = new llvm::LoadInst(llvm::dyn_cast<llvm::PointerType>(ptr->getType())->getPointerElementType(), loadInst,
|
||||
- CI->getName(), (llvm::Instruction *)NULL);
|
||||
+ loadInst = new llvm::LoadInst(llvm::dyn_cast<llvm::PointerType>(ptr->getType())->getPointerElementType(), ptr,
|
||||
+ CI->getName(), false /* not volatile */,
|
||||
+ llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne(),
|
||||
+ (llvm::Instruction *)NULL);
|
||||
#else
|
||||
- loadInst = new llvm::LoadInst(ptr, CI->getName(), (llvm::Instruction *)NULL);
|
||||
+ loadInst = new llvm::LoadInst(ptr, CI->getName(), false,
|
||||
+ llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne(),
|
||||
+ (llvm::Instruction *)NULL);
|
||||
#endif
|
||||
+
|
||||
Assert(loadInst);
|
||||
return loadInst;
|
||||
}
|
||||
@@ -6606,7 +6669,11 @@ llvm::Instruction *FixAddressSpace::processVectorStore(llvm::StoreInst *SI) {
|
||||
// Note: it doesn't look like a normal case for GenX target
|
||||
if (valType->getScalarType()->isPointerTy()) {
|
||||
auto scalarType = g->target->is32Bit() ? LLVMTypes::Int32Type : LLVMTypes::Int64Type;
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ valType = llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::VectorType>(valType)->getNumElements());
|
||||
+#else
|
||||
valType = llvm::VectorType::get(scalarType, valType->getVectorNumElements());
|
||||
+#endif
|
||||
val = new llvm::PtrToIntInst(val, valType, "svm_st_val_ptrtoint", SI);
|
||||
}
|
||||
|
||||
@@ -6631,12 +6698,8 @@ llvm::Instruction *FixAddressSpace::processSVMVectorStore(llvm::Instruction *CI)
|
||||
ptr = new llvm::IntToPtrInst(ptr, llvm::PointerType::get(valType, 0), CI->getName() + "_inttoptr", CI);
|
||||
|
||||
llvm::Instruction *storeInst = NULL;
|
||||
-#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
- loadInst = new llvm::StoreInst(val, llvm::dyn_cast<llvm::PointerType>(ptr->getType())->getPointerElementType(),
|
||||
- storeInst, CI->getName(), (llvm::Instruction *)NULL);
|
||||
-#else
|
||||
- storeInst = new llvm::StoreInst(val, ptr, (llvm::Instruction *)NULL);
|
||||
-#endif
|
||||
+ storeInst = new llvm::StoreInst(val, ptr, (llvm::Instruction *)NULL,
|
||||
+ llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne());
|
||||
Assert(storeInst);
|
||||
return storeInst;
|
||||
}
|
||||
@@ -6645,15 +6708,18 @@ llvm::Instruction *FixAddressSpace::createInt8WrRegion(llvm::Value *Val, llvm::V
|
||||
int width = g->target->getVectorWidth();
|
||||
|
||||
llvm::Value *Args[8];
|
||||
-
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ Args[0] = llvm::UndefValue::get(llvm::FixedVectorType::get(LLVMTypes::Int8Type, width * 4)); // old value
|
||||
+#else
|
||||
Args[0] = llvm::UndefValue::get(llvm::VectorType::get(LLVMTypes::Int8Type, width * 4)); // old value
|
||||
- Args[1] = Val; // value to store
|
||||
- Args[2] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 0); // vstride
|
||||
- Args[3] = llvm::ConstantInt::get(LLVMTypes::Int32Type, width); // width
|
||||
- Args[4] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 4); // stride
|
||||
- Args[5] = llvm::ConstantInt::get(LLVMTypes::Int16Type, 0); // offsets
|
||||
- Args[6] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 0); // parent width (ignored)
|
||||
- Args[7] = Mask; // mask
|
||||
+#endif
|
||||
+ Args[1] = Val; // value to store
|
||||
+ Args[2] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 0); // vstride
|
||||
+ Args[3] = llvm::ConstantInt::get(LLVMTypes::Int32Type, width); // width
|
||||
+ Args[4] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 4); // stride
|
||||
+ Args[5] = llvm::ConstantInt::get(LLVMTypes::Int16Type, 0); // offsets
|
||||
+ Args[6] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 0); // parent width (ignored)
|
||||
+ Args[7] = Mask; // mask
|
||||
|
||||
llvm::Type *Tys[4];
|
||||
|
||||
@@ -6708,7 +6774,12 @@ llvm::Instruction *FixAddressSpace::processGatherScatterPrivate(llvm::CallInst *
|
||||
return NULL;
|
||||
|
||||
llvm::Value *address = calculateGatherScatterAddress(ptr, offsets, CI);
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ llvm::Type *i8VecType = llvm::FixedVectorType::get(LLVMTypes::Int8Type, width * 4);
|
||||
+#else
|
||||
llvm::Type *i8VecType = llvm::VectorType::get(LLVMTypes::Int8Type, width * 4);
|
||||
+#endif
|
||||
+
|
||||
bool isInt8 = (value->getType()->getScalarType() == LLVMTypes::Int8Type);
|
||||
|
||||
Assert(address && "Bad gather/scatter address!");
|
|
@ -0,0 +1,126 @@
|
|||
From bb3f493d1fbd45c79e1d9dee67a0430ba313eaad Mon Sep 17 00:00:00 2001
|
||||
From: Arina Neshlyaeva <arina.neshlyaeva@intel.com>
|
||||
Date: Tue, 19 Jan 2021 11:07:33 -0800
|
||||
Subject: [PATCH] Fixed ifdefs for LLVM_11
|
||||
|
||||
---
|
||||
src/ctx.cpp | 6 +++---
|
||||
src/opt.cpp | 18 +++++++++---------
|
||||
2 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/ctx.cpp b/src/ctx.cpp
|
||||
index 2a72e6837..527a02f30 100644
|
||||
--- a/src/ctx.cpp
|
||||
+++ b/src/ctx.cpp
|
||||
@@ -1691,7 +1691,7 @@ llvm::Value *FunctionEmitContext::SmearUniform(llvm::Value *value, const llvm::T
|
||||
if (llvm::Constant *const_val = llvm::dyn_cast<llvm::Constant>(value)) {
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
ret = llvm::ConstantVector::getSplat(g->target->getVectorWidth(), const_val);
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
|
||||
ret =
|
||||
llvm::ConstantVector::getSplat({static_cast<unsigned int>(g->target->getVectorWidth()), false}, const_val);
|
||||
#else // LLVM 12.0+
|
||||
@@ -3148,7 +3148,7 @@ llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vec
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
llvm::Constant *zeroVec = llvm::ConstantVector::getSplat(
|
||||
vecType->getVectorNumElements(), llvm::Constant::getNullValue(llvm::Type::getInt32Ty(*g->ctx)));
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
|
||||
llvm::Constant *zeroVec =
|
||||
llvm::ConstantVector::getSplat({static_cast<unsigned int>(ty->getNumElements()), false},
|
||||
llvm::Constant::getNullValue(llvm::Type::getInt32Ty(*g->ctx)));
|
||||
@@ -3688,7 +3688,7 @@ llvm::Value *FunctionEmitContext::GenXSimdCFPredicate(llvm::Value *value, llvm::
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
defaults = llvm::ConstantVector::getSplat(vt->getVectorNumElements(),
|
||||
llvm::Constant::getNullValue(vt->getElementType()));
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
|
||||
defaults = llvm::ConstantVector::getSplat({static_cast<unsigned int>(vt->getNumElements()), false},
|
||||
llvm::Constant::getNullValue(vt->getElementType()));
|
||||
#else
|
||||
diff --git a/src/opt.cpp b/src/opt.cpp
|
||||
index 1789b8476..3ff191a0a 100644
|
||||
--- a/src/opt.cpp
|
||||
+++ b/src/opt.cpp
|
||||
@@ -1045,7 +1045,7 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
align = g->target->getNativeVectorAlignment();
|
||||
else
|
||||
align = callInst->getCalledFunction() == avxMaskedLoad32 ? 4 : 8;
|
||||
-#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
|
||||
+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
llvm::Instruction *loadInst =
|
||||
new llvm::LoadInst(castPtr, llvm::Twine(callInst->getArgOperand(0)->getName()) + "_load",
|
||||
false /* not volatile */, llvm::MaybeAlign(align), (llvm::Instruction *)NULL);
|
||||
@@ -1472,7 +1472,7 @@ static llvm::Value *lGetBasePtrAndOffsets(llvm::Value *ptrs, llvm::Value **offse
|
||||
llvm::Value *zeroMask =
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
llvm::ConstantVector::getSplat(cv->getType()->getVectorNumElements(),
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
|
||||
llvm::ConstantVector::getSplat(
|
||||
{llvm::dyn_cast<llvm::VectorType>(cv->getType())->getNumElements(), false},
|
||||
#else // LLVM 12.0+
|
||||
@@ -1495,7 +1495,7 @@ static llvm::Value *lGetBasePtrAndOffsets(llvm::Value *ptrs, llvm::Value **offse
|
||||
llvm::Value *zeroMask = llvm::ConstantVector::getSplat(
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
bop_var_type->getVectorNumElements(),
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
|
||||
{llvm::dyn_cast<llvm::VectorType>(bop_var_type)->getNumElements(), false},
|
||||
#else // LLVM 12.0+
|
||||
llvm::ElementCount::get(
|
||||
@@ -2803,7 +2803,7 @@ static bool lGSToLoadStore(llvm::CallInst *callInst) {
|
||||
llvm::Value *zeroMask =
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
llvm::ConstantVector::getSplat(callInst->getType()->getVectorNumElements(),
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
|
||||
llvm::ConstantVector::getSplat(
|
||||
{llvm::dyn_cast<llvm::VectorType>(callInst->getType())->getNumElements(), false},
|
||||
|
||||
@@ -3100,7 +3100,7 @@ static bool lImproveMaskedLoad(llvm::CallInst *callInst, llvm::BasicBlock::itera
|
||||
{
|
||||
llvm::Type *ptrType = llvm::PointerType::get(callInst->getType(), 0);
|
||||
ptr = new llvm::BitCastInst(ptr, ptrType, "ptr_cast_for_load", callInst);
|
||||
-#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
|
||||
+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
load = new llvm::LoadInst(
|
||||
ptr, callInst->getName(), false /* not volatile */,
|
||||
llvm::MaybeAlign(g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align)
|
||||
@@ -3459,7 +3459,7 @@ llvm::Value *lGEPAndLoad(llvm::Value *basePtr, int64_t offset, int align, llvm::
|
||||
llvm::Type *type) {
|
||||
llvm::Value *ptr = lGEPInst(basePtr, LLVMInt64(offset), "new_base", insertBefore);
|
||||
ptr = new llvm::BitCastInst(ptr, llvm::PointerType::get(type, 0), "ptr_cast", insertBefore);
|
||||
-#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
|
||||
+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
return new llvm::LoadInst(ptr, "gather_load", false /* not volatile */, llvm::MaybeAlign(align), insertBefore);
|
||||
#else // LLVM 11.0+
|
||||
return new llvm::LoadInst(llvm::dyn_cast<llvm::PointerType>(ptr->getType())->getPointerElementType(), ptr,
|
||||
@@ -6183,7 +6183,7 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
Args.push_back(llvm::ConstantVector::getSplat(
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
g->target->getNativeVectorWidth(),
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
|
||||
{static_cast<unsigned int>(g->target->getNativeVectorWidth()), false},
|
||||
#else // LLVM 12.0+
|
||||
llvm::ElementCount::get(static_cast<unsigned int>(g->target->getNativeVectorWidth()), false),
|
||||
@@ -6195,7 +6195,7 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
llvm::Value *zeroMask = llvm::ConstantVector::getSplat(
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
g->target->getNativeVectorWidth(),
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
|
||||
{static_cast<unsigned int>(g->target->getNativeVectorWidth()), false},
|
||||
#else // LLVM 12.0+
|
||||
llvm::ElementCount::get(static_cast<unsigned int>(g->target->getNativeVectorWidth()), false),
|
||||
@@ -6567,7 +6567,7 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
|
||||
llvm::Constant *zeroVec = llvm::ConstantVector::getSplat(
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
addressType->getVectorNumElements(),
|
||||
-#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
|
||||
+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
|
||||
{llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements(), false},
|
||||
#else
|
||||
llvm::ElementCount::get(
|
|
@ -0,0 +1,160 @@
|
|||
From 62f5a6c37bf26fc25a7cf81868052d3472874610 Mon Sep 17 00:00:00 2001
|
||||
From: Arina Neshlyaeva <arina.neshlyaeva@intel.com>
|
||||
Date: Tue, 23 Mar 2021 23:07:30 -0700
|
||||
Subject: [PATCH] Do not generate function mask when it is not required
|
||||
|
||||
---
|
||||
src/ctx.cpp | 39 ++++++++++++++-------
|
||||
tests/lit-tests/full_mask.ispc | 63 ++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 90 insertions(+), 12 deletions(-)
|
||||
create mode 100644 tests/lit-tests/full_mask.ispc
|
||||
|
||||
diff --git a/src/ctx.cpp b/src/ctx.cpp
|
||||
index 527a02f30..9e775fc5c 100644
|
||||
--- a/src/ctx.cpp
|
||||
+++ b/src/ctx.cpp
|
||||
@@ -231,10 +231,18 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym, llvm::F
|
||||
internalMaskPointer = AllocaInst(LLVMTypes::MaskType, "internal_mask_memory");
|
||||
StoreInst(LLVMMaskAllOn, internalMaskPointer);
|
||||
|
||||
- functionMaskValue = LLVMMaskAllOn;
|
||||
-
|
||||
- fullMaskPointer = AllocaInst(LLVMTypes::MaskType, "full_mask_memory");
|
||||
- StoreInst(LLVMMaskAllOn, fullMaskPointer);
|
||||
+ // If the function doesn't have __mask in parameters, there is no need to
|
||||
+ // have function mask
|
||||
+ if ((func->GetType()->isExported &&
|
||||
+ (lf->getFunctionType()->getNumParams() == func->GetType()->GetNumParameters())) ||
|
||||
+ (func->GetType()->isUnmasked) || (func->GetType()->isTask)) {
|
||||
+ functionMaskValue = NULL;
|
||||
+ fullMaskPointer = NULL;
|
||||
+ } else {
|
||||
+ functionMaskValue = LLVMMaskAllOn;
|
||||
+ fullMaskPointer = AllocaInst(LLVMTypes::MaskType, "full_mask_memory");
|
||||
+ StoreInst(LLVMMaskAllOn, fullMaskPointer);
|
||||
+ }
|
||||
|
||||
blockEntryMask = NULL;
|
||||
breakLanesPtr = continueLanesPtr = NULL;
|
||||
@@ -389,20 +397,26 @@ llvm::BasicBlock *FunctionEmitContext::GetCurrentBasicBlock() { return bblock; }
|
||||
|
||||
void FunctionEmitContext::SetCurrentBasicBlock(llvm::BasicBlock *bb) { bblock = bb; }
|
||||
|
||||
-llvm::Value *FunctionEmitContext::GetFunctionMask() { return functionMaskValue; }
|
||||
+llvm::Value *FunctionEmitContext::GetFunctionMask() { return fullMaskPointer ? functionMaskValue : LLVMMaskAllOn; }
|
||||
|
||||
llvm::Value *FunctionEmitContext::GetInternalMask() { return LoadInst(internalMaskPointer, NULL, "load_mask"); }
|
||||
|
||||
llvm::Value *FunctionEmitContext::GetFullMask() {
|
||||
- return BinaryOperator(llvm::Instruction::And, GetInternalMask(), functionMaskValue, "internal_mask&function_mask");
|
||||
+ return fullMaskPointer ? BinaryOperator(llvm::Instruction::And, GetInternalMask(), functionMaskValue,
|
||||
+ "internal_mask&function_mask")
|
||||
+ : GetInternalMask();
|
||||
}
|
||||
|
||||
-llvm::Value *FunctionEmitContext::GetFullMaskPointer() { return fullMaskPointer; }
|
||||
+llvm::Value *FunctionEmitContext::GetFullMaskPointer() {
|
||||
+ return fullMaskPointer ? fullMaskPointer : internalMaskPointer;
|
||||
+}
|
||||
|
||||
void FunctionEmitContext::SetFunctionMask(llvm::Value *value) {
|
||||
- functionMaskValue = value;
|
||||
- if (bblock != NULL)
|
||||
- StoreInst(GetFullMask(), fullMaskPointer);
|
||||
+ if (fullMaskPointer != NULL) {
|
||||
+ functionMaskValue = value;
|
||||
+ if (bblock != NULL)
|
||||
+ StoreInst(GetFullMask(), fullMaskPointer);
|
||||
+ }
|
||||
}
|
||||
|
||||
void FunctionEmitContext::SetBlockEntryMask(llvm::Value *value) { blockEntryMask = value; }
|
||||
@@ -410,7 +424,8 @@ void FunctionEmitContext::SetBlockEntryMask(llvm::Value *value) { blockEntryMask
|
||||
void FunctionEmitContext::SetInternalMask(llvm::Value *value) {
|
||||
StoreInst(value, internalMaskPointer);
|
||||
// kludge so that __mask returns the right value in ispc code.
|
||||
- StoreInst(GetFullMask(), fullMaskPointer);
|
||||
+ if (fullMaskPointer)
|
||||
+ StoreInst(GetFullMask(), fullMaskPointer);
|
||||
}
|
||||
|
||||
void FunctionEmitContext::SetInternalMaskAnd(llvm::Value *oldMask, llvm::Value *test) {
|
||||
@@ -1265,7 +1280,7 @@ void FunctionEmitContext::CurrentLanesReturned(Expr *expr, bool doCoherenceCheck
|
||||
// lanes have returned
|
||||
if (doCoherenceCheck) {
|
||||
// if newReturnedLanes == functionMaskValue, get out of here!
|
||||
- llvm::Value *cmp = MasksAllEqual(functionMaskValue, newReturnedLanes);
|
||||
+ llvm::Value *cmp = MasksAllEqual(GetFunctionMask(), newReturnedLanes);
|
||||
llvm::BasicBlock *bDoReturn = CreateBasicBlock("do_return");
|
||||
llvm::BasicBlock *bNoReturn = CreateBasicBlock("no_return");
|
||||
BranchInst(bDoReturn, bNoReturn, cmp);
|
||||
diff --git a/tests/lit-tests/full_mask.ispc b/tests/lit-tests/full_mask.ispc
|
||||
new file mode 100644
|
||||
index 000000000..ac0b0bca3
|
||||
--- /dev/null
|
||||
+++ b/tests/lit-tests/full_mask.ispc
|
||||
@@ -0,0 +1,63 @@
|
||||
+// RUN: %{ispc} %s -DISPC_EXPORT --emit-llvm-text -O0 --nowrap -o %t.ll
|
||||
+// RUN: FileCheck --input-file=%t.ll -check-prefix=CHECK_ISPC_EXPORT %s
|
||||
+
|
||||
+// RUN: %{ispc} %s -DISPC_UNMASKED --emit-llvm-text -O0 --nowrap -o %t.ll
|
||||
+// RUN: FileCheck --input-file=%t.ll -check-prefix=CHECK_ISPC_UNMASKED %s
|
||||
+
|
||||
+// RUN: %{ispc} %s -DISPC_NOQUALIF --emit-llvm-text -O0 --nowrap -o %t.ll
|
||||
+// RUN: FileCheck --input-file=%t.ll -check-prefix=CHECK_ISPC_NOQUALIF %s
|
||||
+
|
||||
+// RUN: %{ispc} %s -DISPC_TASK --emit-llvm-text -O0 --nowrap -o %t.ll
|
||||
+// RUN: FileCheck --input-file=%t.ll -check-prefix=CHECK_ISPC_TASK %s
|
||||
+
|
||||
+struct Parameters {
|
||||
+ float *vout;
|
||||
+ int param;
|
||||
+};
|
||||
+
|
||||
+#ifdef ISPC_EXPORT
|
||||
+// CHECK_ISPC_EXPORT: define void @simple_export___
|
||||
+// CHECK_ISPC_EXPORT: %full_mask_memory = alloca
|
||||
+// CHECK_ISPC_EXPORT: define void @simple_export(
|
||||
+// CHECK_ISPC_EXPORT-NOT: %full_mask_memory = alloca
|
||||
+export void simple_export(void *uniform _p) {
|
||||
+ Parameters *uniform p = (Parameters * uniform) _p;
|
||||
+ if (programIndex > p->param)
|
||||
+ p->vout[programIndex] = programCount * programIndex;
|
||||
+}
|
||||
+#endif
|
||||
+#ifdef ISPC_UNMASKED
|
||||
+// CHECK_ISPC_UNMASKED: define void @simple_unmasked
|
||||
+// CHECK_ISPC_UNMASKED-NOT: %full_mask_memory = alloca
|
||||
+unmasked void simple_unmasked(void *uniform _p) {
|
||||
+ Parameters *uniform p = (Parameters * uniform) _p;
|
||||
+ if (programIndex > p->param)
|
||||
+ p->vout[programIndex] = programCount * programIndex;
|
||||
+}
|
||||
+#endif
|
||||
+#ifdef ISPC_NOQUALIF
|
||||
+// CHECK_ISPC_NOQUALIF: define void @simple
|
||||
+// CHECK_ISPC_NOQUALIF: %full_mask_memory = alloca
|
||||
+void simple(void *uniform _p) {
|
||||
+ Parameters *uniform p = (Parameters * uniform) _p;
|
||||
+ if (programIndex > p->param)
|
||||
+ p->vout[programIndex] = programCount * programIndex;
|
||||
+}
|
||||
+#endif
|
||||
+#ifdef ISPC_TASK
|
||||
+
|
||||
+// CHECK_ISPC_TASK: define void @simple_task
|
||||
+// CHECK_ISPC_TASK-NOT: %full_mask_memory = alloca
|
||||
+// CHECK_ISPC_TASK: define void @simple_entry_point__
|
||||
+// CHECK_ISPC_TASK: %full_mask_memory = alloca
|
||||
+// CHECK_ISPC_TASK: define void @simple_entry_point(
|
||||
+// CHECK_ISPC_TASK-NOT: %full_mask_memory = alloca
|
||||
+task void simple_task(void *uniform _p) {
|
||||
+ Parameters *uniform p = (Parameters * uniform) _p;
|
||||
+ if (programIndex > p->param)
|
||||
+ p->vout[programIndex] = programCount * programIndex;
|
||||
+}
|
||||
+export void simple_entry_point(void *uniform parameters, uniform int dim0, uniform int dim1, uniform int dim2) {
|
||||
+ launch[dim0, dim1, dim2] simple_task(parameters);
|
||||
+}
|
||||
+#endif
|
||||
\ No newline at end of file
|
|
@ -0,0 +1,149 @@
|
|||
From afad14227d9204a3c8a626ca608f5b43c3218fe9 Mon Sep 17 00:00:00 2001
|
||||
From: Arina Neshlyaeva <arina.neshlyaeva@intel.com>
|
||||
Date: Tue, 4 May 2021 11:43:52 -0700
|
||||
Subject: [PATCH] Fixed ISPC gen build for LLVM12
|
||||
|
||||
---
|
||||
src/ctx.cpp | 4 ++++
|
||||
src/opt.cpp | 43 +++++++++++++++++++++++++++++--------------
|
||||
2 files changed, 33 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/ctx.cpp b/src/ctx.cpp
|
||||
index 0c7050591..f7dc06939 100644
|
||||
--- a/src/ctx.cpp
|
||||
+++ b/src/ctx.cpp
|
||||
@@ -3738,7 +3738,11 @@ llvm::Value *FunctionEmitContext::GenXSimdCFAny(llvm::Value *value) {
|
||||
|
||||
llvm::Value *FunctionEmitContext::GenXSimdCFPredicate(llvm::Value *value, llvm::Value *defaults) {
|
||||
AssertPos(currentPos, llvm::isa<llvm::VectorType>(value->getType()));
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ llvm::FixedVectorType *vt = llvm::dyn_cast<llvm::FixedVectorType>(value->getType());
|
||||
+#else
|
||||
llvm::VectorType *vt = llvm::dyn_cast<llvm::VectorType>(value->getType());
|
||||
+#endif
|
||||
if (defaults == NULL) {
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
defaults = llvm::ConstantVector::getSplat(vt->getVectorNumElements(),
|
||||
diff --git a/src/opt.cpp b/src/opt.cpp
|
||||
index cea4afa23..4e33d6b1a 100644
|
||||
--- a/src/opt.cpp
|
||||
+++ b/src/opt.cpp
|
||||
@@ -2916,9 +2916,13 @@ static llvm::Function *lGenXMaskedInt8Inst(llvm::Instruction *inst, bool isStore
|
||||
|
||||
static llvm::CallInst *lGenXStoreInst(llvm::Value *val, llvm::Value *ptr, llvm::Instruction *inst) {
|
||||
Assert(g->target->isGenXTarget());
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ Assert(llvm::isa<llvm::FixedVectorType>(val->getType()));
|
||||
+ llvm::FixedVectorType *valVecType = llvm::dyn_cast<llvm::FixedVectorType>(val->getType());
|
||||
+#else
|
||||
Assert(llvm::isa<llvm::VectorType>(val->getType()));
|
||||
-
|
||||
llvm::VectorType *valVecType = llvm::dyn_cast<llvm::VectorType>(val->getType());
|
||||
+#endif
|
||||
Assert(llvm::isPowerOf2_32(valVecType->getNumElements()));
|
||||
Assert(valVecType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
|
||||
|
||||
@@ -2942,9 +2946,13 @@ static llvm::CallInst *lGenXStoreInst(llvm::Value *val, llvm::Value *ptr, llvm::
|
||||
}
|
||||
|
||||
static llvm::CallInst *lGenXLoadInst(llvm::Value *ptr, llvm::Type *retType, llvm::Instruction *inst) {
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ Assert(llvm::isa<llvm::FixedVectorType>(retType));
|
||||
+ llvm::FixedVectorType *retVecType = llvm::dyn_cast<llvm::FixedVectorType>(retType);
|
||||
+#else
|
||||
Assert(llvm::isa<llvm::VectorType>(retType));
|
||||
-
|
||||
llvm::VectorType *retVecType = llvm::dyn_cast<llvm::VectorType>(retType);
|
||||
+#endif
|
||||
Assert(llvm::isPowerOf2_32(retVecType->getNumElements()));
|
||||
Assert(retVecType->getPrimitiveSizeInBits());
|
||||
Assert(retVecType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
|
||||
@@ -5485,8 +5493,13 @@ static void lCreateBlockLDUse(llvm::Instruction *currInst, std::vector<llvm::Ext
|
||||
} else if (auto gather = lGetPseudoGather(llvm::dyn_cast<llvm::Instruction>(ui->getUser()))) {
|
||||
// Collect idxs from gather and fix users
|
||||
llvm::Value *res = llvm::UndefValue::get(gather->getType());
|
||||
- for (unsigned i = 0, end = llvm::dyn_cast<llvm::VectorType>(res->getType())->getNumElements(); i < end;
|
||||
- ++i) {
|
||||
+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
+ for (unsigned i = 0, end = llvm::dyn_cast<llvm::FixedVectorType>(res->getType())->getNumElements(); i < end;
|
||||
+ ++i)
|
||||
+#else
|
||||
+ for (unsigned i = 0, end = llvm::dyn_cast<llvm::VectorType>(res->getType())->getNumElements(); i < end; ++i)
|
||||
+#endif
|
||||
+ {
|
||||
// Get element via IEI
|
||||
res = llvm::InsertElementInst::Create(res, EEIs[ptrUse.idxs[curr_idx++]],
|
||||
llvm::ConstantInt::get(LLVMTypes::Int32Type, i),
|
||||
@@ -5522,10 +5535,11 @@ static bool lVectorizeGEPs(llvm::Value *ptr, std::vector<PtrUse> &ptrUses, std::
|
||||
|
||||
// Adjust values for vector load
|
||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
- if (auto vecTy = llvm::dyn_cast<llvm::FixedVectorType>(type)) {
|
||||
+ if (auto vecTy = llvm::dyn_cast<llvm::FixedVectorType>(type))
|
||||
#else
|
||||
- if (auto vecTy = llvm::dyn_cast<llvm::VectorType>(type)) {
|
||||
+ if (auto vecTy = llvm::dyn_cast<llvm::VectorType>(type))
|
||||
#endif
|
||||
+ {
|
||||
// Get single element size
|
||||
t_size /= vecTy->getNumElements();
|
||||
// Get single element type
|
||||
@@ -6477,7 +6491,7 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
|
||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
Offsets,
|
||||
llvm::FixedVectorType::get(LLVMTypes::Int64Type,
|
||||
- llvm::dyn_cast<llvm::VectorType>(Offsets->getType())->getNumElements()),
|
||||
+ llvm::dyn_cast<llvm::FixedVectorType>(Offsets->getType())->getNumElements()),
|
||||
"svm_offset_zext", InsertBefore);
|
||||
#else
|
||||
Offsets, llvm::VectorType::get(LLVMTypes::Int64Type, Offsets->getType()->getVectorNumElements()),
|
||||
@@ -6492,7 +6506,7 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
|
||||
llvm::Value *undefInsertValue =
|
||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
llvm::UndefValue::get(llvm::FixedVectorType::get(
|
||||
- LLVMTypes::Int64Type, llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements()));
|
||||
+ LLVMTypes::Int64Type, llvm::dyn_cast<llvm::FixedVectorType>(addressType)->getNumElements()));
|
||||
#else
|
||||
llvm::UndefValue::get(llvm::VectorType::get(LLVMTypes::Int64Type, addressType->getVectorNumElements()));
|
||||
#endif
|
||||
@@ -6501,17 +6515,16 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
|
||||
#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
|
||||
addressType->getVectorNumElements(),
|
||||
#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
|
||||
- {llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements(), false},
|
||||
+ {llvm::dyn_cast<llvm::FixedVectorType>(addressType)->getNumElements(), false},
|
||||
#else
|
||||
- llvm::ElementCount::get(
|
||||
- llvm::dyn_cast<llvm::FixedVectorType>(addressType->getNumElements(), false),
|
||||
+ llvm::ElementCount::get(llvm::dyn_cast<llvm::FixedVectorType>(addressType)->getNumElements(), false),
|
||||
#endif
|
||||
llvm::Constant::getNullValue(llvm::Type::getInt32Ty(InsertBefore->getContext())));
|
||||
|
||||
llvm::Value *undefShuffleValue =
|
||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
llvm::UndefValue::get(llvm::FixedVectorType::get(
|
||||
- LLVMTypes::Int64Type, llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements()));
|
||||
+ LLVMTypes::Int64Type, llvm::dyn_cast<llvm::FixedVectorType>(addressType)->getNumElements()));
|
||||
#else
|
||||
llvm::UndefValue::get(llvm::VectorType::get(LLVMTypes::Int64Type, addressType->getVectorNumElements()));
|
||||
#endif
|
||||
@@ -6542,7 +6555,8 @@ llvm::Instruction *FixAddressSpace::processVectorLoad(llvm::LoadInst *LI) {
|
||||
isPtrLoad = true;
|
||||
auto scalarType = g->target->is32Bit() ? LLVMTypes::Int32Type : LLVMTypes::Int64Type;
|
||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
- retType = llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::VectorType>(retType)->getNumElements());
|
||||
+ retType =
|
||||
+ llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::FixedVectorType>(retType)->getNumElements());
|
||||
#else
|
||||
retType = llvm::VectorType::get(scalarType, retType->getVectorNumElements());
|
||||
#endif
|
||||
@@ -6604,7 +6618,8 @@ llvm::Instruction *FixAddressSpace::processVectorStore(llvm::StoreInst *SI) {
|
||||
if (valType->getScalarType()->isPointerTy()) {
|
||||
auto scalarType = g->target->is32Bit() ? LLVMTypes::Int32Type : LLVMTypes::Int64Type;
|
||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
|
||||
- valType = llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::VectorType>(valType)->getNumElements());
|
||||
+ valType =
|
||||
+ llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::FixedVectorType>(valType)->getNumElements());
|
||||
#else
|
||||
valType = llvm::VectorType::get(scalarType, valType->getVectorNumElements());
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'ispc'
|
||||
pkgname=ispc
|
||||
version=1.15.0
|
||||
revision=1
|
||||
revision=2
|
||||
archs="x86_64*"
|
||||
build_style=cmake
|
||||
configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"
|
||||
|
|
Loading…
Reference in New Issue