summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Sotkin <alexey.sotkin@intel.com>2018-03-05 11:55:34 +0300
committerAlexey Sotkin <alexey.sotkin@intel.com>2018-04-03 17:17:38 +0300
commit223c78694394a61819ebc3e9b834dd8a38ec8678 (patch)
tree46dc1711f211fff985145074b24faebccfe1163a
parent0f1efec411c52d4757b025a69295cee066e356af (diff)
Upgrade SPIRV translator from LLVM 3.6 to LLVM 3.8
Change-Id: I97247b6472ff75ea83e12a485e06809ad2d2061c
-rw-r--r--lib/SPIRV/Mangler/Mangler.cpp30
-rw-r--r--lib/SPIRV/Mangler/ManglingUtils.cpp30
-rw-r--r--lib/SPIRV/Mangler/ManglingUtils.h2
-rw-r--r--lib/SPIRV/Mangler/ParameterType.h4
-rw-r--r--lib/SPIRV/OCL20ToSPIRV.cpp14
-rw-r--r--lib/SPIRV/OCLTypeToSPIRV.cpp8
-rw-r--r--lib/SPIRV/OCLUtil.cpp29
-rw-r--r--lib/SPIRV/SPIRVInternal.h2
-rw-r--r--lib/SPIRV/SPIRVLowerConstExpr.cpp6
-rw-r--r--lib/SPIRV/SPIRVLowerOCLBlocks.cpp36
-rw-r--r--lib/SPIRV/SPIRVReader.cpp49
-rw-r--r--lib/SPIRV/SPIRVRegularizeLLVM.cpp13
-rw-r--r--lib/SPIRV/SPIRVToOCL20.cpp4
-rw-r--r--lib/SPIRV/SPIRVUtil.cpp56
-rw-r--r--lib/SPIRV/SPIRVWriter.cpp61
-rw-r--r--test/AtomicCompareExchange_cl12.ll8
-rw-r--r--test/AtomicCompareExchange_cl20.ll16
-rw-r--r--test/ExecutionMode.ll16
-rw-r--r--test/SampledImage.ll8
-rw-r--r--test/SamplerArgNonKernel.ll4
-rw-r--r--test/global_block.ll2
-rw-r--r--test/image-unoptimized.ll20
-rw-r--r--test/layout.ll2
-rw-r--r--test/link-attribute.ll2
-rw-r--r--test/linkage-types.ll10
-rw-r--r--test/multi_md.ll16
-rw-r--r--test/simple.ll60
-rw-r--r--test/store.ll2
-rw-r--r--test/transcoding/AtomicCompareExchangeExplicit_cl20.ll8
-rw-r--r--test/transcoding/AtomicCompareExchange_cl20.ll20
-rw-r--r--test/transcoding/BuildNDRange_2.ll8
-rw-r--r--test/transcoding/OpConstantBool.ll2
-rw-r--r--test/transcoding/OpGenericPtrMemSemantics.ll8
-rw-r--r--test/transcoding/OpGroupAsyncCopy.ll48
-rw-r--r--test/transcoding/OpImageReadMS.ll2
-rw-r--r--test/transcoding/OpImageSampleExplicitLod.ll10
-rw-r--r--test/transcoding/OpMemoryBarrier_cl20.ll28
-rw-r--r--test/transcoding/OpPhi_ArgumentsPlaceholders.ll6
-rw-r--r--test/transcoding/atomic_store.ll2
-rw-r--r--test/transcoding/atomics_1.2.ll74
-rw-r--r--test/transcoding/bitcast.ll6
-rw-r--r--test/transcoding/device_execution.ll8
-rw-r--r--test/transcoding/device_execution_multiple_blocks.ll4
-rw-r--r--test/transcoding/device_execution_overloading.ll42
-rw-r--r--test/transcoding/device_execution_simple_local_memory.ll24
-rw-r--r--test/transcoding/fclamp.ll4
-rw-r--r--test/transcoding/image_with_access_qualifiers.ll2
-rw-r--r--test/transcoding/isequal.ll10
-rw-r--r--test/transcoding/pipe_builtins.ll60
-rw-r--r--tools/llvm-spirv/llvm-spirv.cpp12
50 files changed, 507 insertions, 391 deletions
diff --git a/lib/SPIRV/Mangler/Mangler.cpp b/lib/SPIRV/Mangler/Mangler.cpp
index aa2c333..5b891c8 100644
--- a/lib/SPIRV/Mangler/Mangler.cpp
+++ b/lib/SPIRV/Mangler/Mangler.cpp
@@ -84,8 +84,25 @@ public:
// Visit methods
//
MangleError visit(const PrimitiveType* t) {
+ MangleError me = MANGLE_SUCCESS;
+#if defined(SPIRV_SPIR20_MANGLING_REQUIREMENTS)
m_stream << mangledPrimitiveString(t->getPrimitive());
- return MANGLE_SUCCESS;
+#else
+ std::string mangledPrimitive = std::string(mangledPrimitiveString(t->getPrimitive()));
+ // out of all enums it makes sense to substitute only memory_scope/memory_order
+ // since only they appear several times in the builtin declaration.
+ if (mangledPrimitive.compare("12memory_scope") == 0 ||
+ mangledPrimitive.compare("12memory_order") == 0) {
+ if (!mangleSubstitution(t, mangledPrimitiveString(t->getPrimitive()))) {
+ size_t index = m_stream.str().size();
+ m_stream << mangledPrimitiveString(t->getPrimitive());
+ substitutions[m_stream.str().substr(index)] = seqId++;
+ }
+ } else {
+ m_stream << mangledPrimitive;
+ }
+#endif
+ return me;
}
MangleError visit(const PointerType* p) {
@@ -133,8 +150,15 @@ public:
}
MangleError visit(const AtomicType* p) {
- m_stream << "U" << "7_Atomic";
- return p->getBaseType()->accept(this);
+ MangleError me = MANGLE_SUCCESS;
+ size_t index = m_stream.str().size();
+ const char* typeStr = "U7_Atomic";
+ if (!mangleSubstitution(p, typeStr)) {
+ m_stream << typeStr;
+ me = p->getBaseType()->accept(this);
+ substitutions[m_stream.str().substr(index)] = seqId++;
+ }
+ return me;
}
MangleError visit(const BlockType* p) {
diff --git a/lib/SPIRV/Mangler/ManglingUtils.cpp b/lib/SPIRV/Mangler/ManglingUtils.cpp
index 645d31a..4ee3fc2 100644
--- a/lib/SPIRV/Mangler/ManglingUtils.cpp
+++ b/lib/SPIRV/Mangler/ManglingUtils.cpp
@@ -51,6 +51,8 @@ namespace SPIR {
"sampler_t",
"kernel_enqueue_flags_t",
"clk_profiling_info",
+ "memory_order",
+ "memory_scope"
};
const char* mangledTypes[PRIMITIVE_NUM] = {
@@ -87,12 +89,14 @@ namespace SPIR {
"9ndrange_t", //PRIMITIVE_NDRANGE_T
"12ocl_clkevent", //PRIMITIVE_CLK_EVENT_T
"11ocl_sampler", //PRIMITIVE_SAMPLER_T
-#if defined(SPIRV_SPIR20_MANGLING_REQUIREMENTS)
"i", //PRIMITIVE_KERNEL_ENQUEUE_FLAGS_T
"i", //PRIMITIVE_CLK_PROFILING_INFO
+#if defined(SPIRV_SPIR20_MANGLING_REQUIREMENTS)
+ "i", //PRIMITIVE_MEMORY_ORDER
+ "i", //PRIMITIVE_MEMORY_SCOPE
#else
- "22kernel_enqueue_flags_t", //PRIMITIVE_KERNEL_ENQUEUE_FLAGS_T
- "18clk_profiling_info", //PRIMITIVE_CLK_PROFILING_INFO
+ "12memory_order", //PRIMITIVE_MEMORY_ORDER
+ "12memory_scope" //PRIMITIVE_MEMORY_SCOPE
#endif
};
@@ -192,4 +196,24 @@ namespace SPIR {
}
}
+ bool isPipeBuiltin(std::string unmangledName) {
+ return
+ unmangledName == "write_pipe" ||
+ unmangledName == "read_pipe" ||
+ unmangledName == "reserve_write_pipe" ||
+ unmangledName == "reserve_read_pipe" ||
+ unmangledName == "commit_write_pipe" ||
+ unmangledName == "commit_read_pipe" ||
+ unmangledName == "work_group_reserve_write_pipe" ||
+ unmangledName == "work_group_reserve_read_pipe" ||
+ unmangledName == "work_group_commit_write_pipe" ||
+ unmangledName == "work_group_commit_read_pipe" ||
+ unmangledName == "get_pipe_num_packets" ||
+ unmangledName == "get_pipe_max_packets" ||
+ unmangledName == "sub_group_reserve_write_pipe" ||
+ unmangledName == "sub_group_reserve_read_pipe" ||
+ unmangledName == "sub_group_commit_write_pipe" ||
+ unmangledName == "sub_group_commit_read_pipe";
+ }
+
} // End SPIR namespace
diff --git a/lib/SPIRV/Mangler/ManglingUtils.h b/lib/SPIRV/Mangler/ManglingUtils.h
index 6fc5572..943ceac 100644
--- a/lib/SPIRV/Mangler/ManglingUtils.h
+++ b/lib/SPIRV/Mangler/ManglingUtils.h
@@ -27,6 +27,8 @@ namespace SPIR {
const char* getSPIRVersionAsString(SPIRversion version);
const char* mangledPrimitiveStringfromName(std::string type);
+
+ bool isPipeBuiltin(std::string unmangledName);
} // End SPIR namespace
#endif //__MANGLING_UTILS_H__
diff --git a/lib/SPIRV/Mangler/ParameterType.h b/lib/SPIRV/Mangler/ParameterType.h
index 8089e8e..41c46bb 100644
--- a/lib/SPIRV/Mangler/ParameterType.h
+++ b/lib/SPIRV/Mangler/ParameterType.h
@@ -73,7 +73,9 @@ namespace SPIR {
PRIMITIVE_SAMPLER_T,
PRIMITIVE_KERNEL_ENQUEUE_FLAGS_T,
PRIMITIVE_CLK_PROFILING_INFO,
- PRIMITIVE_LAST = PRIMITIVE_CLK_PROFILING_INFO,
+ PRIMITIVE_MEMORY_ORDER,
+ PRIMITIVE_MEMORY_SCOPE,
+ PRIMITIVE_LAST = PRIMITIVE_MEMORY_SCOPE,
PRIMITIVE_NONE,
// Keep this at the end.
PRIMITIVE_NUM = PRIMITIVE_NONE
diff --git a/lib/SPIRV/OCL20ToSPIRV.cpp b/lib/SPIRV/OCL20ToSPIRV.cpp
index 32aaed8..d786d73 100644
--- a/lib/SPIRV/OCL20ToSPIRV.cpp
+++ b/lib/SPIRV/OCL20ToSPIRV.cpp
@@ -1191,9 +1191,9 @@ OCL20ToSPIRV::visitCallBuiltinSimple(CallInst* CI,
void OCL20ToSPIRV::transWorkItemBuiltinsToVariables() {
DEBUG(dbgs() << "Enter transWorkItemBuiltinsToVariables\n");
std::vector<Function *> WorkList;
- for (auto I = M->begin(), E = M->end(); I != E; ++I) {
+ for (auto &I:*M) {
std::string DemangledName;
- if (!oclIsBuiltin(I->getName(), &DemangledName))
+ if (!oclIsBuiltin(I.getName(), &DemangledName))
continue;
DEBUG(dbgs() << "Function demangled name: " << DemangledName << '\n');
std::string BuiltinVarName;
@@ -1203,9 +1203,9 @@ void OCL20ToSPIRV::transWorkItemBuiltinsToVariables() {
BuiltinVarName = std::string(kSPIRVName::Prefix) +
SPIRVBuiltInNameMap::map(BVKind);
DEBUG(dbgs() << "builtin variable name: " << BuiltinVarName << '\n');
- bool IsVec = I->getFunctionType()->getNumParams() > 0;
- Type *GVType = IsVec ? VectorType::get(I->getReturnType(),3) :
- I->getReturnType();
+ bool IsVec = I.getFunctionType()->getNumParams() > 0;
+ Type *GVType = IsVec ? VectorType::get(I.getReturnType(),3) :
+ I.getReturnType();
auto BV = new GlobalVariable(*M, GVType,
true,
GlobalValue::ExternalLinkage,
@@ -1214,7 +1214,7 @@ void OCL20ToSPIRV::transWorkItemBuiltinsToVariables() {
GlobalVariable::NotThreadLocal,
SPIRAS_Constant);
std::vector<Instruction *> InstList;
- for (auto UI = I->user_begin(), UE = I->user_end(); UI != UE; ++UI) {
+ for (auto UI = I.user_begin(), UE = I.user_end(); UI != UE; ++UI) {
auto CI = dyn_cast<CallInst>(*UI);
assert(CI && "invalid instruction");
Value * NewValue = new LoadInst(BV, "", CI);
@@ -1232,7 +1232,7 @@ void OCL20ToSPIRV::transWorkItemBuiltinsToVariables() {
for (auto &Inst:InstList) {
Inst->eraseFromParent();
}
- WorkList.push_back(I);
+ WorkList.push_back(&I);
}
for (auto &I:WorkList) {
I->eraseFromParent();
diff --git a/lib/SPIRV/OCLTypeToSPIRV.cpp b/lib/SPIRV/OCLTypeToSPIRV.cpp
index f088620..5ebff5d 100644
--- a/lib/SPIRV/OCLTypeToSPIRV.cpp
+++ b/lib/SPIRV/OCLTypeToSPIRV.cpp
@@ -128,7 +128,7 @@ static unsigned
getArgIndex(Function *F, Value *V) {
auto A = F->arg_begin(), E = F->arg_end();
for (unsigned I = 0; A != E; ++I, ++A) {
- if (A == V)
+ if (&(*A) == V)
return I;
}
llvm_unreachable("Not argument of function");
@@ -139,7 +139,7 @@ static Argument*
getArg(Function *F, unsigned I) {
auto AI = F->arg_begin();
std::advance(AI, I);
- return AI;
+ return &(*AI);
}
/// Create a new function type if \param F has arguments in AdaptedTy, and
@@ -323,7 +323,7 @@ OCLTypeToSPIRV::adaptArgumentsByMetadata(Function* F) {
auto OCLTyStr = getMDOperandAsString(TypeMD, I);
auto NewTy = *PI;
if (OCLTyStr == OCL_TYPE_NAME_SAMPLER_T && !NewTy->isStructTy()) {
- addAdaptedType(Arg, getSamplerType(M));
+ addAdaptedType(&(*Arg), getSamplerType(M));
Changed = true;
} else if (isPointerToOpaqueStructType(NewTy)) {
auto STName = NewTy->getPointerElementType()->getStructName();
@@ -333,7 +333,7 @@ OCLTypeToSPIRV::adaptArgumentsByMetadata(Function* F) {
auto AccMD = getArgAccessQualifierMetadata(F);
assert(AccMD && "Invalid access qualifier metadata");
auto AccStr = getMDOperandAsString(AccMD, I);
- addAdaptedType(Arg, getOrCreateOpaquePtrType(M,
+ addAdaptedType(&(*Arg), getOrCreateOpaquePtrType(M,
mapOCLTypeNameToSPIRV(Ty, AccStr)));
Changed = true;
}
diff --git a/lib/SPIRV/OCLUtil.cpp b/lib/SPIRV/OCLUtil.cpp
index 33f59f2..10a660c 100644
--- a/lib/SPIRV/OCLUtil.cpp
+++ b/lib/SPIRV/OCLUtil.cpp
@@ -363,9 +363,9 @@ getOCLOpaqueTypeAddrSpace(SPIR::TypePrimitiveEnum prim) {
// Fetch type of invoke function passed to device execution built-ins
static FunctionType *
getBlockInvokeTy(Function * F, unsigned blockIdx) {
- auto params = F->getFunctionType()->params();
- PointerType * funcPtr = cast<PointerType>(params[blockIdx]);
- return cast<FunctionType>(funcPtr->getElementType());
+ auto params = F->getFunctionType()->params();
+ PointerType * funcPtr = cast<PointerType>(params[blockIdx]);
+ return cast<FunctionType>(funcPtr->getElementType());
}
class OCLBuiltinFuncMangleInfo : public SPIRV::BuiltinFuncMangleInfo {
@@ -406,9 +406,9 @@ public:
} else if (UnmangledName.find("get_") == 0 ||
UnmangledName == "nan" ||
UnmangledName == "mem_fence" ||
- UnmangledName.find("shuffle") == 0){
+ UnmangledName.find("shuffle") == 0) {
addUnsignedArg(-1);
- if (UnmangledName.find(kOCLBuiltinName::GetFence) == 0){
+ if (UnmangledName.find(kOCLBuiltinName::GetFence) == 0) {
setArgAttr(0, SPIR::ATTR_CONST);
addVoidPtrArg(0);
}
@@ -418,10 +418,12 @@ public:
addUnsignedArg(0);
} else if (UnmangledName.find("atomic_work_item_fence") == 0) {
addUnsignedArg(0);
+ setEnumArg(1, SPIR::PRIMITIVE_MEMORY_ORDER);
+ setEnumArg(2, SPIR::PRIMITIVE_MEMORY_SCOPE);
} else if (UnmangledName.find("atomic") == 0) {
setArgAttr(0, SPIR::ATTR_VOLATILE);
if (UnmangledName.find("atomic_umax") == 0 ||
- UnmangledName.find("atomic_umin") == 0) {
+ UnmangledName.find("atomic_umin") == 0) {
addUnsignedArg(0);
addUnsignedArg(1);
UnmangledName.erase(7, 1);
@@ -431,6 +433,21 @@ public:
addUnsignedArg(1);
UnmangledName.erase(13, 1);
}
+ if (UnmangledName.find("store_explicit") != std::string::npos ||
+ UnmangledName.find("exchange_explicit") != std::string::npos ||
+ (UnmangledName.find("atomic_fetch") == 0 && UnmangledName.find("explicit") != std::string::npos)) {
+ setEnumArg(2, SPIR::PRIMITIVE_MEMORY_ORDER);
+ setEnumArg(3, SPIR::PRIMITIVE_MEMORY_SCOPE);
+ } else if (UnmangledName.find("load_explicit") != std::string::npos ||
+ (UnmangledName.find("atomic_flag") == 0 && UnmangledName.find("explicit") != std::string::npos)) {
+ setEnumArg(1, SPIR::PRIMITIVE_MEMORY_ORDER);
+ setEnumArg(2, SPIR::PRIMITIVE_MEMORY_SCOPE);
+ } else if (UnmangledName.find("compare_exchange_strong_explicit") != std::string::npos ||
+ UnmangledName.find("compare_exchange_weak_explicit") != std::string::npos) {
+ setEnumArg(3, SPIR::PRIMITIVE_MEMORY_ORDER);
+ setEnumArg(4, SPIR::PRIMITIVE_MEMORY_ORDER);
+ setEnumArg(5, SPIR::PRIMITIVE_MEMORY_SCOPE);
+ }
// Don't set atomic property to the first argument of 1.2 atomic built-ins.
if(UnmangledName.find("atomic_add") != 0 && UnmangledName.find("atomic_sub") != 0 &&
UnmangledName.find("atomic_xchg") != 0 && UnmangledName.find("atomic_inc") != 0 &&
diff --git a/lib/SPIRV/SPIRVInternal.h b/lib/SPIRV/SPIRVInternal.h
index 45954ff..1bc7fe4 100644
--- a/lib/SPIRV/SPIRVInternal.h
+++ b/lib/SPIRV/SPIRVInternal.h
@@ -407,7 +407,7 @@ public:
init(UniqName);
}
virtual ~BuiltinFuncMangleInfo(){}
- const std::string &getUnmangledName() const { return UnmangledName;}
+ const std::string &getUnmangledName() const { return UnmangledName; }
void addUnsignedArg(int Ndx) { UnsignedArgs.insert(Ndx);}
void addVoidPtrArg(int Ndx) { VoidPtrArgs.insert(Ndx);}
void addSamplerArg(int Ndx) { SamplerArgs.insert(Ndx);}
diff --git a/lib/SPIRV/SPIRVLowerConstExpr.cpp b/lib/SPIRV/SPIRVLowerConstExpr.cpp
index e27b479..9ed1fa9 100644
--- a/lib/SPIRV/SPIRVLowerConstExpr.cpp
+++ b/lib/SPIRV/SPIRVLowerConstExpr.cpp
@@ -118,9 +118,9 @@ SPIRVLowerConstExpr::visit(Module *M) {
std::map<ConstantExpr*, Instruction *> CMap;
std::list<Instruction *> WorkList;
auto FBegin = I->begin();
- for (auto BI = FBegin, BE = I->end(); BI != BE; ++BI) {
- for (auto II = BI->begin(), IE = BI->end(); II != IE; ++II) {
- WorkList.push_back(II);
+ for (auto &BI:*I) {
+ for (auto &II:BI) {
+ WorkList.push_back(&II);
}
}
while (!WorkList.empty()) {
diff --git a/lib/SPIRV/SPIRVLowerOCLBlocks.cpp b/lib/SPIRV/SPIRVLowerOCLBlocks.cpp
index bdb4563..b4106a6 100644
--- a/lib/SPIRV/SPIRVLowerOCLBlocks.cpp
+++ b/lib/SPIRV/SPIRVLowerOCLBlocks.cpp
@@ -103,7 +103,7 @@ public:
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<CallGraphWrapperPass>();
- AU.addRequired<AliasAnalysis>();
+ AU.addRequired<AAResultsWrapperPass>();
AU.addRequired<AssumptionCacheTracker>();
}
@@ -146,7 +146,7 @@ private:
eraseUselessFunctions() {
bool changed = false;
for (auto I = M->begin(), E = M->end(); I != E;) {
- Function *F = I++;
+ Function *F = &(*I++);
if (!GlobalValue::isInternalLinkage(F->getLinkage()) &&
!F->isDeclaration())
continue;
@@ -161,10 +161,20 @@ private:
}
}
}
- if (F->use_empty()) {
- erase(F);
- changed = true;
+
+ if (!F->use_empty()) {
+ continue;
+ }
+
+ auto &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();
+ CallGraphNode* CGN = CG[F];
+
+ if (CGN->getNumReferences() != 0) {
+ continue;
}
+
+ erase(F);
+ changed = true;
}
return changed;
}
@@ -342,8 +352,7 @@ private:
DEBUG(dbgs() << "[lowerReturnBlock] inline " << F->getName() << '\n');
auto CG = &getAnalysis<CallGraphWrapperPass>().getCallGraph();
auto ACT = &getAnalysis<AssumptionCacheTracker>();
- auto AA = &getAnalysis<AliasAnalysis>();
- InlineFunctionInfo IFI(CG, M->getDataLayout(), AA, ACT);
+ InlineFunctionInfo IFI(CG, ACT);
InlineFunction(CI, IFI);
Inlined = true;
}
@@ -567,9 +576,18 @@ private:
dumpUsers(F);
return;
}
+
F->dropAllReferences();
+
auto &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();
- CG.removeFunctionFromModule(new CallGraphNode(F));
+ CallGraphNode* CGN = CG[F];
+
+ if (CGN->getNumReferences() != 0) {
+ return;
+ }
+
+ CGN->removeAllCalledFunctions();
+ delete CG.removeFunctionFromModule(CGN);
}
llvm::PointerType* getOCLClkEventType() {
@@ -605,7 +623,7 @@ INITIALIZE_PASS_BEGIN(SPIRVLowerOCLBlocks, "spvblocks",
"SPIR-V lower OCL blocks", false, false)
INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
-INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
+INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
INITIALIZE_PASS_END(SPIRVLowerOCLBlocks, "spvblocks",
"SPIR-V lower OCL blocks", false, false)
diff --git a/lib/SPIRV/SPIRVReader.cpp b/lib/SPIRV/SPIRVReader.cpp
index 8842294..efc8952 100644
--- a/lib/SPIRV/SPIRVReader.cpp
+++ b/lib/SPIRV/SPIRVReader.cpp
@@ -60,7 +60,7 @@
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
-#include "llvm/PassManager.h"
+#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Dwarf.h"
@@ -206,28 +206,27 @@ public:
DEBUG_METADATA_VERSION);
}
- DIFile getDIFile(const std::string &FileName){
- return getOrInsert(FileMap, FileName, [=](){
+ DIFile* getDIFile(const std::string &FileName){
+ return getOrInsert(FileMap, FileName, [=]() -> DIFile* {
std::string BaseName;
std::string Path;
splitFileName(FileName, BaseName, Path);
if (!BaseName.empty())
return Builder.createFile(BaseName, Path);
else
- return DIFile();
+ return nullptr;
});
}
- DISubprogram getDISubprogram(SPIRVFunction *SF, Function *F){
+ DISubprogram* getDISubprogram(SPIRVFunction *SF, Function *F){
return getOrInsert(FuncMap, F, [=](){
auto DF = getDIFile(SpDbg.getFunctionFileStr(SF));
auto FN = F->getName();
auto LN = SpDbg.getFunctionLineNo(SF);
- Metadata *Args[] = {DIType()};
return Builder.createFunction(DF, FN, FN, DF, LN,
- Builder.createSubroutineType(DF, Builder.getOrCreateTypeArray(Args)),
+ Builder.createSubroutineType(Builder.getOrCreateTypeArray(None)),
Function::isInternalLinkage(F->getLinkage()),
- true, LN, 0, 0, NULL, NULL, NULL);
+ true, LN);
});
}
@@ -259,8 +258,8 @@ private:
SPIRVDbgInfo SpDbg;
DIBuilder Builder;
bool Enable;
- std::unordered_map<std::string, DIFile> FileMap;
- std::unordered_map<Function *, DISubprogram> FuncMap;
+ std::unordered_map<std::string, DIFile *> FileMap;
+ std::unordered_map<Function *, DISubprogram *> FuncMap;
void splitFileName(const std::string &FileName,
std::string &BaseName,
@@ -558,11 +557,11 @@ SPIRVToLLVM::transOCLBuiltinsFromVariables(){
std::vector<GlobalVariable *> WorkList;
for (auto I = M->global_begin(), E = M->global_end(); I != E; ++I) {
SPIRVBuiltinVariableKind Kind;
- if (!isSPIRVBuiltinVariable(I, &Kind))
+ if (!isSPIRVBuiltinVariable(&(*I), &Kind))
continue;
- if (!transOCLBuiltinFromVariable(I, Kind))
+ if (!transOCLBuiltinFromVariable(&(*I), Kind))
return false;
- WorkList.push_back(I);
+ WorkList.push_back(&(*I));
}
for (auto &I:WorkList) {
I->eraseFromParent();
@@ -1053,7 +1052,7 @@ SPIRVToLLVM::postProcessOCL() {
DEBUG(dbgs() << "[postProcessOCL sret] " << *F << '\n');
if (F->getReturnType()->isStructTy() &&
oclIsBuiltin(F->getName(), &DemangledName, isCPP)) {
- if (!postProcessOCLBuiltinReturnStruct(F))
+ if (!postProcessOCLBuiltinReturnStruct(&(*F)))
return false;
}
}
@@ -1063,8 +1062,8 @@ SPIRVToLLVM::postProcessOCL() {
if (F->hasName() && F->isDeclaration()) {
DEBUG(dbgs() << "[postProcessOCL func ptr] " << *F << '\n');
auto AI = F->arg_begin();
- if (hasFunctionPointerArg(F, AI) && isDecoratedSPIRVFunc(F))
- if (!postProcessOCLBuiltinWithFuncPointer(F, AI))
+ if (hasFunctionPointerArg(&(*F), AI) && isDecoratedSPIRVFunc(&(*F)))
+ if (!postProcessOCLBuiltinWithFuncPointer(&(*F), AI))
return false;
}
}
@@ -1072,8 +1071,8 @@ SPIRVToLLVM::postProcessOCL() {
auto F = I++;
if (F->hasName() && F->isDeclaration()) {
DEBUG(dbgs() << "[postProcessOCL array arg] " << *F << '\n');
- if (hasArrayArg(F) && oclIsBuiltin(F->getName(), &DemangledName, isCPP))
- if (!postProcessOCLBuiltinWithArrayArguments(F, DemangledName))
+ if (hasArrayArg(&(*F)) && oclIsBuiltin(F->getName(), &DemangledName, isCPP))
+ if (!postProcessOCLBuiltinWithArrayArguments(&(*F), DemangledName))
return false;
}
}
@@ -1153,7 +1152,7 @@ SPIRVToLLVM::postProcessOCLBuiltinWithArrayArguments(Function* F,
auto T = I->getType();
if (!T->isArrayTy())
continue;
- auto Alloca = new AllocaInst(T, "", FBegin);
+ auto Alloca = new AllocaInst(T, "", &(*FBegin));
auto Store = new StoreInst(I, Alloca, false, CI);
auto Zero = ConstantInt::getNullValue(Type::getInt32Ty(T->getContext()));
Value *Index[] = {Zero, Zero};
@@ -1509,7 +1508,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E;
++I, ++ArgNo) {
if (ArgNo == BA->getArgNo())
- return mapValue(BV, I);
+ return mapValue(BV, &(*I));
}
llvm_unreachable("Invalid argument");
return nullptr;
@@ -1777,11 +1776,11 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
auto IsInbound = AC->isInBounds();
Value *V = nullptr;
if (BB) {
- auto GEP = GetElementPtrInst::Create(Base, Index, BV->getName(), BB);
+ auto GEP = GetElementPtrInst::Create(nullptr, Base, Index, BV->getName(), BB);
GEP->setIsInBounds(IsInbound);
V = GEP;
} else {
- V = ConstantExpr::getGetElementPtr(dyn_cast<Constant>(Base), Index,
+ V = ConstantExpr::getGetElementPtr(nullptr, dyn_cast<Constant>(Base), Index,
IsInbound);
}
return mapValue(BV, V);
@@ -2028,8 +2027,8 @@ SPIRVToLLVM::transFunction(SPIRVFunction *BF) {
for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E;
++I) {
auto BA = BF->getArgument(I->getArgNo());
- mapValue(BA, I);
- setName(I, BA);
+ mapValue(BA, &(*I));
+ setName(&(*I), BA);
BA->foreachAttr([&](SPIRVFuncParamAttrKind Kind){
if (Kind == FunctionParameterAttributeNoWrite)
return;
@@ -2944,7 +2943,7 @@ llvm::ReadSPIRV(LLVMContext &C, std::istream &IS, Module *&M,
BM->getError(ErrMsg);
Succeed = false;
}
- PassManager PassMgr;
+ llvm::legacy::PassManager PassMgr;
PassMgr.add(createSPIRVToOCL20());
PassMgr.add(createOCL20To12());
PassMgr.run(*M);
diff --git a/lib/SPIRV/SPIRVRegularizeLLVM.cpp b/lib/SPIRV/SPIRVRegularizeLLVM.cpp
index 1631b61..a028543 100644
--- a/lib/SPIRV/SPIRVRegularizeLLVM.cpp
+++ b/lib/SPIRV/SPIRVRegularizeLLVM.cpp
@@ -116,7 +116,7 @@ SPIRVRegularizeLLVM::regularize() {
//lowerConstantExpressions();
for (auto I = M->begin(), E = M->end(); I != E;) {
- Function *F = I++;
+ Function *F = &(*I++);
if (F->isDeclaration() && F->use_empty()) {
F->eraseFromParent();
continue;
@@ -192,13 +192,12 @@ void SPIRVRegularizeLLVM::lowerFuncPtr(Function* F, Op OC) {
void
SPIRVRegularizeLLVM::lowerFuncPtr(Module* M) {
std::vector<std::pair<Function *, Op>> Work;
- for (auto I = M->begin(), E = M->end(); I != E;) {
- Function *F = I++;
- auto AI = F->arg_begin();
- if (hasFunctionPointerArg(F, AI)) {
- auto OC = getSPIRVFuncOC(F->getName());
+ for (auto &F:*M) {
+ auto AI = F.arg_begin();
+ if (hasFunctionPointerArg(&F, AI)) {
+ auto OC = getSPIRVFuncOC(F.getName());
assert(OC != OpNop && "Invalid function pointer usage");
- Work.push_back(std::make_pair(F, OC));
+ Work.push_back(std::make_pair(&F, OC));
}
}
for (auto &I:Work)
diff --git a/lib/SPIRV/SPIRVToOCL20.cpp b/lib/SPIRV/SPIRVToOCL20.cpp
index d994490..9fe3632 100644
--- a/lib/SPIRV/SPIRVToOCL20.cpp
+++ b/lib/SPIRV/SPIRVToOCL20.cpp
@@ -308,7 +308,7 @@ void SPIRVToOCL20::visitCallSPRIVImageQuerySize(CallInst *CI) {
if (imgArray) {
assert((imgDim == 1 || imgDim == 2) && "invalid image array type");
// Insert get_image_array_size to the last position of the resulting vector.
- Type * sizeTy = Type::getIntNTy(*Ctx, M->getDataLayout()->getPointerSizeInBits(0));
+ Type * sizeTy = Type::getIntNTy(*Ctx, M->getDataLayout().getPointerSizeInBits(0));
Instruction * getImageArraySize =
addCallInst(M, kOCLBuiltinName::GetImageArraySize, sizeTy,
CI->getArgOperand(0), &attributes,
@@ -370,7 +370,7 @@ void SPIRVToOCL20::visitCallSPIRVAtomicBuiltin(CallInst* CI, Op OC) {
// value by pointer passed as 2nd argument (aka expected) while SPIR-V
// instructions returns this new/original value as a resulting value.
AllocaInst *pExpected = new AllocaInst(CI->getType(), "expected",
- pInsertBefore->getParent()->getParent()->getEntryBlock().getFirstInsertionPt());
+ &(*pInsertBefore->getParent()->getParent()->getEntryBlock().getFirstInsertionPt()));
pExpected->setAlignment(CI->getType()->getScalarSizeInBits() / 8);
new StoreInst(Args[1], pExpected, pInsertBefore);
Args[1] = pExpected;
diff --git a/lib/SPIRV/SPIRVUtil.cpp b/lib/SPIRV/SPIRVUtil.cpp
index 0c75e11..d420044 100644
--- a/lib/SPIRV/SPIRVUtil.cpp
+++ b/lib/SPIRV/SPIRVUtil.cpp
@@ -41,6 +41,10 @@
#include "SPIRVInternal.h"
#include "libSPIRV/SPIRVDecorate.h"
#include "libSPIRV/SPIRVValue.h"
+#include "NameMangleAPI.h"
+#include "ManglingUtils.h"
+#include "ParameterType.h"
+#include "FunctionDescriptor.h"
#include "SPIRVMDWalker.h"
#include "OCLUtil.h"
@@ -819,7 +823,7 @@ addBlockBind(Module *M, Function *InvokeFunc, Value *BlkCtx, Value *CtxLen,
IntegerType* getSizetType(Module *M) {
return IntegerType::getIntNTy(M->getContext(),
- M->getDataLayout()->getPointerSizeInBits(0));
+ M->getDataLayout().getPointerSizeInBits(0));
}
Type *
@@ -1370,19 +1374,37 @@ bool
eraseUselessFunctions(Module *M) {
bool changed = false;
for (auto I = M->begin(), E = M->end(); I != E;)
- changed |= eraseIfNoUse(I++);
+ changed |= eraseIfNoUse(&(*I++));
return changed;
}
+// The mangling algorithm follows OpenCL pipe built-ins clang 3.8 CodeGen rules.
+static SPIR::MangleError
+manglePipeBuiltin(const SPIR::FunctionDescriptor &fd, std::string &mangledName) {
+ assert(SPIR::isPipeBuiltin(fd.name) &&
+ "Method is expected to be called only for pipe builtins!");
+ if (fd.isNull()) {
+ mangledName.assign(SPIR::FunctionDescriptor::nullString());
+ return SPIR::MANGLE_NULL_FUNC_DESCRIPTOR;
+ }
+ mangledName.assign("__" + fd.name);
+ if (fd.name.compare("write_pipe") == 0 || fd.name.compare("read_pipe") == 0) {
+ // add "_2" or "_4" postfix reflecting the number of explicit args.
+ mangledName.append("_");
+ // subtruct 2 in order to not count size and alignment of packet.
+ mangledName.append(std::to_string(fd.parameters.size() - 2));
+ }
+ return SPIR::MANGLE_SUCCESS;
+}
+
std::string
mangleBuiltin(const std::string &UniqName,
- ArrayRef<Type*> ArgTypes, BuiltinFuncMangleInfo* BtnInfo) {
+ ArrayRef<Type*> ArgTypes, BuiltinFuncMangleInfo* BtnInfo) {
if (!BtnInfo)
return UniqName;
BtnInfo->init(UniqName);
std::string MangledName;
DEBUG(dbgs() << "[mangle] " << UniqName << " => ");
- SPIR::NameMangler Mangler(SPIR::SPIR20);
SPIR::FunctionDescriptor FD;
FD.name = BtnInfo->getUnmangledName();
bool BIVarArgNegative = BtnInfo->getVarArg() < 0;
@@ -1390,26 +1412,38 @@ mangleBuiltin(const std::string &UniqName,
if (ArgTypes.empty()) {
// Function signature cannot be ()(void, ...) so if there is an ellipsis
// it must be ()(...)
- if(BIVarArgNegative) {
+ if (BIVarArgNegative) {
FD.parameters.emplace_back(SPIR::RefParamType(new SPIR::PrimitiveType(
SPIR::PRIMITIVE_VOID)));
}
} else {
- for (unsigned I = 0,
- E = BIVarArgNegative ? ArgTypes.size() : (unsigned)BtnInfo->getVarArg();
- I != E; ++I) {
+ for (unsigned I = 0,
+ E = BIVarArgNegative ? ArgTypes.size() : (unsigned)BtnInfo->getVarArg();
+ I != E; ++I) {
auto T = ArgTypes[I];
FD.parameters.emplace_back(transTypeDesc(T, BtnInfo->getTypeMangleInfo(I)));
}
}
// Ellipsis must be the last argument of any function
- if(!BIVarArgNegative) {
+ if (!BIVarArgNegative) {
assert((unsigned)BtnInfo->getVarArg() <= ArgTypes.size()
- && "invalid index of an ellipsis");
+ && "invalid index of an ellipsis");
FD.parameters.emplace_back(SPIR::RefParamType(new SPIR::PrimitiveType(
- SPIR::PRIMITIVE_VAR_ARG)));
+ SPIR::PRIMITIVE_VAR_ARG)));
}
+
+#if defined(SPIRV_SPIR20_MANGLING_REQUIREMENTS)
+ SPIR::NameMangler Mangler(SPIR::SPIR20);
Mangler.mangle(FD, MangledName);
+#else
+ if (SPIR::isPipeBuiltin(BtnInfo->getUnmangledName())) {
+ manglePipeBuiltin(FD, MangledName);
+ } else {
+ SPIR::NameMangler Mangler(SPIR::SPIR20);
+ Mangler.mangle(FD, MangledName);
+ }
+#endif
+
DEBUG(dbgs() << MangledName << '\n');
return MangledName;
}
diff --git a/lib/SPIRV/SPIRVWriter.cpp b/lib/SPIRV/SPIRVWriter.cpp
index e62bca6..127262d 100644
--- a/lib/SPIRV/SPIRVWriter.cpp
+++ b/lib/SPIRV/SPIRVWriter.cpp
@@ -68,9 +68,9 @@
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Verifier.h"
+#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Pass.h"
#include "llvm/PassSupport.h"
-#include "llvm/PassManager.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
@@ -135,15 +135,14 @@ public:
void transDbgInfo(Value *V, SPIRVValue *BV) {
if (auto I = dyn_cast<Instruction>(V)) {
auto DL = I->getDebugLoc();
- if (!DL.isUnknown()) {
- DILocation DIL(DL.getAsMDNode());
- auto File = BM->getString(DIL.getFilename().str());
- BM->addLine(BV, File->getId(), DIL.getLineNumber(), DIL.getColumnNumber());
+ if (DL) {
+ auto File = BM->getString(DL->getFilename().str());
+ BM->addLine(BV, File, DL->getLine(), DL->getColumn());
}
} else if (auto F = dyn_cast<Function>(V)) {
if (auto DIS = getDISubprogram(F)) {
- auto File = BM->getString(DIS.getFilename().str());
- BM->addLine(BV, File->getId(), DIS.getLineNumber(), 0);
+ auto File = BM->getString(DIS->getFilename().str());
+ BM->addLine(BV, File->getId(), DIS->getLine(), 0);
}
}
}
@@ -1437,7 +1436,7 @@ bool
LLVMToSPIRV::transGlobalVariables() {
for (auto I = M->global_begin(),
E = M->global_end(); I != E; ++I) {
- if (!transValue(I, nullptr))
+ if (!transValue(&(*I), nullptr))
return false;
}
return true;
@@ -1470,14 +1469,13 @@ void
LLVMToSPIRV::transFunction(Function *I) {
transFunctionDecl(I);
// Creating all basic blocks before creating any instruction.
- for (Function::iterator FI = I->begin(), FE = I->end(); FI != FE; ++FI) {
- transValue(FI, nullptr);
- }
- for (Function::iterator FI = I->begin(), FE = I->end(); FI != FE; ++FI) {
- SPIRVBasicBlock* BB = static_cast<SPIRVBasicBlock*>(transValue(FI, nullptr));
- for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE;
- ++BI) {
- transValue(BI, BB, false);
+ for (auto &FI:*I) {
+ transValue(&FI, nullptr);
+ }
+ for (auto &FI:*I) {
+ SPIRVBasicBlock* BB = static_cast<SPIRVBasicBlock*>(transValue(&FI, nullptr));
+ for (auto &BI:FI) {
+ transValue(&BI, BB, false);
}
}
}
@@ -1497,26 +1495,25 @@ LLVMToSPIRV::translate() {
if (!transGlobalVariables())
return false;
- for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
- Function *F = I;
- auto FT = F->getFunctionType();
+ for (auto &F:*M) {
+ auto FT = F.getFunctionType();
std::map<unsigned, Type *> ChangedType;
- oclGetMutatedArgumentTypesByBuiltin(FT, ChangedType, F);
- mutateFuncArgType(ChangedType, F);
+ oclGetMutatedArgumentTypesByBuiltin(FT, ChangedType, &F);
+ mutateFuncArgType(ChangedType, &F);
}
// SPIR-V logical layout requires all function declarations go before
// function definitions.
std::vector<Function *> Decls, Defs;
- for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
- if (isBuiltinTransToInst(I) || isBuiltinTransToExtInst(I)
- || I->getName().startswith(SPCV_CAST) ||
- I->getName().startswith(LLVM_MEMCPY))
+ for (auto &F:*M) {
+ if (isBuiltinTransToInst(&F) || isBuiltinTransToExtInst(&F)
+ || F.getName().startswith(SPCV_CAST) ||
+ F.getName().startswith(LLVM_MEMCPY))
continue;
- if (I->isDeclaration())
- Decls.push_back(I);
+ if (F.isDeclaration())
+ Decls.push_back(&F);
else
- Defs.push_back(I);
+ Defs.push_back(&F);
}
for (auto I:Decls)
transFunctionDecl(I);
@@ -1536,7 +1533,7 @@ LLVMToSPIRV::translate() {
llvm::IntegerType* LLVMToSPIRV::getSizetType() {
return IntegerType::getIntNTy(M->getContext(),
- M->getDataLayout()->getPointerSizeInBits());
+ M->getDataLayout().getPointerSizeInBits());
}
void
@@ -1829,7 +1826,7 @@ ModulePass *llvm::createLLVMToSPIRV(SPIRVModule *SMod) {
}
void
-addPassesForSPIRV(PassManager &PassMgr) {
+addPassesForSPIRV(legacy::PassManager &PassMgr) {
if (SPIRVMemToReg)
PassMgr.add(createPromoteMemoryToRegisterPass());
PassMgr.add(createTransOCLMD());
@@ -1846,7 +1843,7 @@ addPassesForSPIRV(PassManager &PassMgr) {
bool
llvm::WriteSPIRV(Module *M, llvm::raw_ostream &OS, std::string &ErrMsg) {
std::unique_ptr<SPIRVModule> BM(SPIRVModule::createSPIRVModule());
- PassManager PassMgr;
+ legacy::PassManager PassMgr;
addPassesForSPIRV(PassMgr);
PassMgr.add(createLLVMToSPIRV(BM.get()));
PassMgr.run(*M);
@@ -1860,7 +1857,7 @@ llvm::WriteSPIRV(Module *M, llvm::raw_ostream &OS, std::string &ErrMsg) {
bool
llvm::RegularizeLLVMForSPIRV(Module *M, std::string &ErrMsg) {
std::unique_ptr<SPIRVModule> BM(SPIRVModule::createSPIRVModule());
- PassManager PassMgr;
+ legacy::PassManager PassMgr;
addPassesForSPIRV(PassMgr);
PassMgr.run(*M);
return true;
diff --git a/test/AtomicCompareExchange_cl12.ll b/test/AtomicCompareExchange_cl12.ll
index f52f521..c7517d5 100644
--- a/test/AtomicCompareExchange_cl12.ll
+++ b/test/AtomicCompareExchange_cl12.ll
@@ -26,15 +26,15 @@ entry:
store i32 addrspace(1)* %object, i32 addrspace(1)** %object.addr, align 4
store i32 %expected, i32* %expected.addr, align 4
store i32 %desired, i32* %desired.addr, align 4
- %0 = load i32 addrspace(1)** %object.addr, align 4
- %1 = load i32* %expected.addr, align 4
- %2 = load i32* %desired.addr, align 4
+ %0 = load i32 addrspace(1)*, i32 addrspace(1)** %object.addr, align 4
+ %1 = load i32, i32* %expected.addr, align 4
+ %2 = load i32, i32* %desired.addr, align 4
%call = call spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(i32 addrspace(1)* %0, i32 %1, i32 %2)
; CHECK 9 AtomicCompareExchange [[int]] [[result:[0-9]+]] [[Pointer]] [[DeviceScope]] [[SequentiallyConsistent_MS]] [[SequentiallyConsistent_MS]] [[Value]] [[Comparator]]
store i32 %call, i32* %res, align 4
- %3 = load i32* %res, align 4
+ %3 = load i32, i32* %res, align 4
ret i32 %3
; CHECK 2 ReturnValue [[result]]
}
diff --git a/test/AtomicCompareExchange_cl20.ll b/test/AtomicCompareExchange_cl20.ll
index 3dc4f39..fae6d6a 100644
--- a/test/AtomicCompareExchange_cl20.ll
+++ b/test/AtomicCompareExchange_cl20.ll
@@ -33,9 +33,9 @@ entry:
store i32 addrspace(4)* %object, i32 addrspace(4)** %object.addr, align 4
store i32 addrspace(4)* %expected, i32 addrspace(4)** %expected.addr, align 4
store i32 %desired, i32* %desired.addr, align 4
- %0 = load i32 addrspace(4)** %object.addr, align 4
- %1 = load i32 addrspace(4)** %expected.addr, align 4
- %2 = load i32* %desired.addr, align 4
+ %0 = load i32 addrspace(4)*, i32 addrspace(4)** %object.addr, align 4
+ %1 = load i32 addrspace(4)*, i32 addrspace(4)** %expected.addr, align 4
+ %2 = load i32, i32* %desired.addr, align 4
%call = call spir_func zeroext i1 @_Z30atomic_compare_exchange_strongPVU3AS4U7_AtomiciPU3AS4ii(i32 addrspace(4)* %0, i32 addrspace(4)* %1, i32 %2)
; CHECK: Load [[int]] [[Comparator:[0-9]+]] [[ComparatorPtr]]
@@ -45,14 +45,14 @@ entry:
; CHECK-NOT: [[Result]]
%frombool = zext i1 %call to i8
store i8 %frombool, i8* %strong_res, align 1
- %3 = load i8* %strong_res, align 1
+ %3 = load i8, i8* %strong_res, align 1
%tobool = trunc i8 %3 to i1
%lnot = xor i1 %tobool, true
%frombool1 = zext i1 %lnot to i8
store i8 %frombool1, i8* %res, align 1
- %4 = load i32 addrspace(4)** %object.addr, align 4
- %5 = load i32 addrspace(4)** %expected.addr, align 4
- %6 = load i32* %desired.addr, align 4
+ %4 = load i32 addrspace(4)*, i32 addrspace(4)** %object.addr, align 4
+ %5 = load i32 addrspace(4)*, i32 addrspace(4)** %expected.addr, align 4
+ %6 = load i32, i32* %desired.addr, align 4
%call2 = call spir_func zeroext i1 @_Z28atomic_compare_exchange_weakPVU3AS4U7_AtomiciPU3AS4ii(i32 addrspace(4)* %4, i32 addrspace(4)* %5, i32 %6)
; CHECK: Load [[int]] [[ComparatorWeak:[0-9]+]] [[ComparatorPtr]]
@@ -63,7 +63,7 @@ entry:
%frombool3 = zext i1 %call2 to i8
store i8 %frombool3, i8* %weak_res, align 1
- %7 = load i8* %weak_res, align 1
+ %7 = load i8, i8* %weak_res, align 1
%tobool4 = trunc i8 %7 to i1
%lnot5 = xor i1 %tobool4, true
%frombool6 = zext i1 %lnot5 to i8
diff --git a/test/ExecutionMode.ll b/test/ExecutionMode.ll
index 285ebc8..309595e 100644
--- a/test/ExecutionMode.ll
+++ b/test/ExecutionMode.ll
@@ -40,8 +40,8 @@ entry:
%i.addr = alloca i32, align 4
store %struct.global_ctor_dtor addrspace(4)* %this, %struct.global_ctor_dtor addrspace(4)** %this.addr, align 4
store i32 %i, i32* %i.addr, align 4
- %this1 = load %struct.global_ctor_dtor addrspace(4)** %this.addr
- %0 = load i32* %i.addr, align 4
+ %this1 = load %struct.global_ctor_dtor addrspace(4)*, %struct.global_ctor_dtor addrspace(4)** %this.addr
+ %0 = load i32, i32* %i.addr, align 4
call spir_func void @_ZNU3AS416global_ctor_dtorC2Ei(%struct.global_ctor_dtor addrspace(4)* %this1, i32 %0)
ret void
}
@@ -51,7 +51,7 @@ define linkonce_odr spir_func void @_ZNU3AS416global_ctor_dtorD1Ev(%struct.globa
entry:
%this.addr = alloca %struct.global_ctor_dtor addrspace(4)*, align 4
store %struct.global_ctor_dtor addrspace(4)* %this, %struct.global_ctor_dtor addrspace(4)** %this.addr, align 4
- %this1 = load %struct.global_ctor_dtor addrspace(4)** %this.addr
+ %this1 = load %struct.global_ctor_dtor addrspace(4)*, %struct.global_ctor_dtor addrspace(4)** %this.addr
call spir_func void @_ZNU3AS416global_ctor_dtorD2Ev(%struct.global_ctor_dtor addrspace(4)* %this1) #0
ret void
}
@@ -76,8 +76,8 @@ define linkonce_odr spir_func void @_ZNU3AS416global_ctor_dtorD2Ev(%struct.globa
entry:
%this.addr = alloca %struct.global_ctor_dtor addrspace(4)*, align 4
store %struct.global_ctor_dtor addrspace(4)* %this, %struct.global_ctor_dtor addrspace(4)** %this.addr, align 4
- %this1 = load %struct.global_ctor_dtor addrspace(4)** %this.addr
- %a = getelementptr inbounds %struct.global_ctor_dtor addrspace(4)* %this1, i32 0, i32 0
+ %this1 = load %struct.global_ctor_dtor addrspace(4)*, %struct.global_ctor_dtor addrspace(4)** %this.addr
+ %a = getelementptr inbounds %struct.global_ctor_dtor, %struct.global_ctor_dtor addrspace(4)* %this1, i32 0, i32 0
store i32 0, i32 addrspace(4)* %a, align 4
ret void
}
@@ -89,9 +89,9 @@ entry:
%i.addr = alloca i32, align 4
store %struct.global_ctor_dtor addrspace(4)* %this, %struct.global_ctor_dtor addrspace(4)** %this.addr, align 4
store i32 %i, i32* %i.addr, align 4
- %this1 = load %struct.global_ctor_dtor addrspace(4)** %this.addr
- %0 = load i32* %i.addr, align 4
- %a = getelementptr inbounds %struct.global_ctor_dtor addrspace(4)* %this1, i32 0, i32 0
+ %this1 = load %struct.global_ctor_dtor addrspace(4)*, %struct.global_ctor_dtor addrspace(4)** %this.addr
+ %0 = load i32, i32* %i.addr, align 4
+ %a = getelementptr inbounds %struct.global_ctor_dtor, %struct.global_ctor_dtor addrspace(4)* %this1, i32 0, i32 0
store i32 %0, i32 addrspace(4)* %a, align 4
ret void
}
diff --git a/test/SampledImage.ll b/test/SampledImage.ll
index 669db31..7adb4c7 100644
--- a/test/SampledImage.ll
+++ b/test/SampledImage.ll
@@ -29,14 +29,14 @@ define spir_kernel void @sample_kernel(%opencl.image2d_t addrspace(1)* %input, <
; CHECK-SPIRV: FunctionParameter [[TypeSampler]] [[argSampl:[0-9]+]]
; CHECK-LLVM: define spir_kernel void @sample_kernel(%opencl.image2d_t addrspace(1)* %input, <2 x float> %coords, <4 x float> addrspace(1)* %results, i32 %argSampl)
entry:
- %0 = load i32* @imageSampler, align 4
+ %0 = load i32, i32* @imageSampler, align 4
%call = call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)* %input, i32 %0, <2 x float> %coords)
; CHECK-SPIRV: SampledImage [[SampledImageTy]] [[SampledImage1:[0-9]+]] [[InputImage]] [[ConstSampler1]]
; CHECK-SPIRV: ImageSampleExplicitLod {{.*}} [[SampledImage1]]
; CHECK-LLVM: call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)* %input, i32 32, <2 x float> %coords)
- %arrayidx = getelementptr inbounds <4 x float> addrspace(1)* %results, i32 0
+ %arrayidx = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %results, i32 0
store <4 x float> %call, <4 x float> addrspace(1)* %arrayidx, align 16
%call1 = call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)* %input, i32 %argSampl, <2 x float> %coords)
@@ -44,7 +44,7 @@ entry:
; CHECK-SPIRV: ImageSampleExplicitLod {{.*}} [[SampledImage2]]
; CHECK-LLVM: call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)* %input, i32 %argSampl, <2 x float> %coords)
- %arrayidx2 = getelementptr inbounds <4 x float> addrspace(1)* %results, i32 0
+ %arrayidx2 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %results, i32 0
store <4 x float> %call1, <4 x float> addrspace(1)* %arrayidx2, align 16
%call3 = call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)* %input, i32 22, <2 x float> %coords)
@@ -52,7 +52,7 @@ entry:
; CHECK-SPIRV: ImageSampleExplicitLod {{.*}} [[SampledImage3]]
; CHECK-LLVM: call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)* %input, i32 22, <2 x float> %coords)
- %arrayidx4 = getelementptr inbounds <4 x float> addrspace(1)* %results, i32 0
+ %arrayidx4 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %results, i32 0
store <4 x float> %call3, <4 x float> addrspace(1)* %arrayidx4, align 16
ret void
}
diff --git a/test/SamplerArgNonKernel.ll b/test/SamplerArgNonKernel.ll
index 2c26f5a..4d5ff78 100644
--- a/test/SamplerArgNonKernel.ll
+++ b/test/SamplerArgNonKernel.ll
@@ -34,8 +34,8 @@ define spir_kernel void @test2(%opencl.image2d_t addrspace(1)* %Img, float addrs
;CHECK: Function {{[0-9]+}} [[KernelId]]
entry:
%call = call spir_func float @test(%opencl.image2d_t addrspace(1)* %Img, i32 0)
- %arrayidx = getelementptr inbounds float addrspace(1)* %result, i32 0
- %0 = load float addrspace(1)* %arrayidx, align 4
+ %arrayidx = getelementptr inbounds float, float addrspace(1)* %result, i32 0
+ %0 = load float, float addrspace(1)* %arrayidx, align 4
%add = fadd float %0, %call
store float %add, float addrspace(1)* %arrayidx, align 4
ret void
diff --git a/test/global_block.ll b/test/global_block.ll
index 7656065..cf43b18 100644
--- a/test/global_block.ll
+++ b/test/global_block.ll
@@ -36,7 +36,7 @@ target triple = "spir-unknown-unknown"
; Function Attrs: nounwind
define spir_kernel void @block_kernel(i32 addrspace(1)* %res) #0 {
entry:
- %0 = load %opencl.block* addrspace(2)* @block_kernel.b1, align 4
+ %0 = load %opencl.block*, %opencl.block* addrspace(2)* @block_kernel.b1, align 4
%1 = call i8* @spir_get_block_invoke(%opencl.block* %0)
%2 = call i8* @spir_get_block_context(%opencl.block* %0)
%3 = bitcast i8* %1 to i32 (i8*, i32)*
diff --git a/test/image-unoptimized.ll b/test/image-unoptimized.ll
index f3c1be4..b2f33ee 100644
--- a/test/image-unoptimized.ll
+++ b/test/image-unoptimized.ll
@@ -23,23 +23,23 @@ entry:
store i32 %call, i32* %tid_x, align 4
%call1 = call spir_func i32 @_Z13get_global_idj(i32 1) #2
store i32 %call1, i32* %tid_y, align 4
- %0 = load %opencl.image2d_t addrspace(1)** %srcimg.addr, align 4
- %1 = load i32* %sampler.addr, align 4
- %2 = load i32* %tid_x, align 4
+ %0 = load %opencl.image2d_t addrspace(1)*, %opencl.image2d_t addrspace(1)** %srcimg.addr, align 4
+ %1 = load i32, i32* %sampler.addr, align 4
+ %2 = load i32, i32* %tid_x, align 4
%vecinit = insertelement <2 x i32> undef, i32 %2, i32 0
- %3 = load i32* %tid_y, align 4
+ %3 = load i32, i32* %tid_y, align 4
%vecinit2 = insertelement <2 x i32> %vecinit, i32 %3, i32 1
store <2 x i32> %vecinit2, <2 x i32>* %.compoundliteral
- %4 = load <2 x i32>* %.compoundliteral
+ %4 = load <2 x i32>, <2 x i32>* %.compoundliteral
%call3 = call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_i(%opencl.image2d_t addrspace(1)* %0, i32 %1, <2 x i32> %4) #2
- %5 = load i32* %tid_y, align 4
- %6 = load %opencl.image2d_t addrspace(1)** %srcimg.addr, align 4
+ %5 = load i32, i32* %tid_y, align 4
+ %6 = load %opencl.image2d_t addrspace(1)*, %opencl.image2d_t addrspace(1)** %srcimg.addr, align 4
%call4 = call spir_func i32 @_Z15get_image_width11ocl_image2d(%opencl.image2d_t addrspace(1)* %6) #2
%mul = mul nsw i32 %5, %call4
- %7 = load i32* %tid_x, align 4
+ %7 = load i32, i32* %tid_x, align 4
%add = add nsw i32 %mul, %7
- %8 = load <4 x float> addrspace(1)** %results.addr, align 4
- %arrayidx = getelementptr inbounds <4 x float> addrspace(1)* %8, i32 %add
+ %8 = load <4 x float> addrspace(1)*, <4 x float> addrspace(1)** %results.addr, align 4
+ %arrayidx = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %8, i32 %add
store <4 x float> %call3, <4 x float> addrspace(1)* %arrayidx, align 16
ret void
}
diff --git a/test/layout.ll b/test/layout.ll
index 784bc8b..7420977 100644
--- a/test/layout.ll
+++ b/test/layout.ll
@@ -135,7 +135,7 @@ target triple = "spir"
define spir_kernel void @foo(<3 x i32> addrspace(1)* %a) #0 {
entry:
call spir_func void @bar1(<3 x i32> addrspace(1)* %a)
- %loadVec4 = load <4 x i32> addrspace(2)* bitcast (<3 x i32> addrspace(2)* @b to <4 x i32> addrspace(2)*)
+ %loadVec4 = load <4 x i32> , <4 x i32> addrspace(2)* bitcast (<3 x i32> addrspace(2)* @b to <4 x i32> addrspace(2)*)
%extractVec = shufflevector <4 x i32> %loadVec4, <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2>
call spir_func void @bar2(<3 x i32> addrspace(1)* %a, <3 x i32> %extractVec)
ret void
diff --git a/test/link-attribute.ll b/test/link-attribute.ll
index 5acedeb..f6b077e 100644
--- a/test/link-attribute.ll
+++ b/test/link-attribute.ll
@@ -25,7 +25,7 @@ define spir_kernel void @sample_kernel(%opencl.image2d_t addrspace(1)* %input, f
%11 = insertelement <2 x float> %9, float %10, i32 1
%12 = tail call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)* %input, i32 36, <2 x float> %11) #1
%13 = sext i32 %7 to i64
- %14 = getelementptr inbounds <4 x float> addrspace(1)* %results, i64 %13
+ %14 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %results, i64 %13
store <4 x float> %12, <4 x float> addrspace(1)* %14, align 16, !tbaa !11
ret void
}
diff --git a/test/linkage-types.ll b/test/linkage-types.ll
index c329467..bae9194 100644
--- a/test/linkage-types.ll
+++ b/test/linkage-types.ll
@@ -100,15 +100,15 @@ define spir_func void @f() #0 {
entry:
%q = alloca i32, align 4
%r = alloca i32, align 4
- %0 = load i32 addrspace(1)* @i2, align 4
+ %0 = load i32, i32 addrspace(1)* @i2, align 4
store i32 %0, i32* %q, align 4
- %1 = load i32 addrspace(1)* @i3, align 4
+ %1 = load i32, i32 addrspace(1)* @i3, align 4
store i32 %1, i32 addrspace(1)* @i5, align 4
- %2 = load i32 addrspace(1)* @e, align 4
+ %2 = load i32, i32 addrspace(1)* @e, align 4
store i32 %2, i32* %r, align 4
- %3 = load i32 addrspace(2)* getelementptr inbounds ([256 x i32] addrspace(2)* @noise_table, i32 0, i32 0), align 4
+ %3 = load i32, i32 addrspace(2)* getelementptr inbounds ([256 x i32], [256 x i32] addrspace(2)* @noise_table, i32 0, i32 0), align 4
store i32 %3, i32* %r, align 4
- %4 = load i32 addrspace(2)* getelementptr inbounds ([2 x i32] addrspace(2)* @f.color_table, i32 0, i32 0), align 4
+ %4 = load i32, i32 addrspace(2)* getelementptr inbounds ([2 x i32], [2 x i32] addrspace(2)* @f.color_table, i32 0, i32 0), align 4
store i32 %4, i32* %r, align 4
%call = call spir_func i32 @g()
call spir_func void @inline_fun()
diff --git a/test/multi_md.ll b/test/multi_md.ll
index ea52e6a..4a5f760 100644
--- a/test/multi_md.ll
+++ b/test/multi_md.ll
@@ -19,10 +19,10 @@ entry:
%i.addr = alloca i32, align 4
store i8 %c, i8* %c.addr, align 1, !tbaa !14
store i32 %i, i32* %i.addr, align 4, !tbaa !17
- %0 = load i8* %c.addr, align 1, !tbaa !14
- store i8 %0, i8 addrspace(1)* getelementptr inbounds (%struct.my_struct_t addrspace(1)* @var, i32 0, i32 0), align 1, !tbaa !19
- %1 = load i32* %i.addr, align 4, !tbaa !17
- store i32 %1, i32 addrspace(1)* getelementptr inbounds (%struct.my_struct_t addrspace(1)* @var, i32 0, i32 1), align 4, !tbaa !21
+ %0 = load i8, i8* %c.addr, align 1, !tbaa !14
+ store i8 %0, i8 addrspace(1)* getelementptr inbounds (%struct.my_struct_t, %struct.my_struct_t addrspace(1)* @var, i32 0, i32 0), align 1, !tbaa !19
+ %1 = load i32, i32* %i.addr, align 4, !tbaa !17
+ store i32 %1, i32 addrspace(1)* getelementptr inbounds (%struct.my_struct_t, %struct.my_struct_t addrspace(1)* @var, i32 0, i32 1), align 4, !tbaa !21
ret void
}
@@ -33,11 +33,11 @@ entry:
%I.addr = alloca i32 addrspace(1)*, align 8
store i8 addrspace(1)* %C, i8 addrspace(1)** %C.addr, align 8, !tbaa !22
store i32 addrspace(1)* %I, i32 addrspace(1)** %I.addr, align 8, !tbaa !22
- %0 = load i8 addrspace(1)* getelementptr inbounds (%struct.my_struct_t addrspace(1)* @var, i32 0, i32 0), align 1, !tbaa !19
- %1 = load i8 addrspace(1)** %C.addr, align 8, !tbaa !22
+ %0 = load i8, i8 addrspace(1)* getelementptr inbounds (%struct.my_struct_t, %struct.my_struct_t addrspace(1)* @var, i32 0, i32 0), align 1, !tbaa !19
+ %1 = load i8 addrspace(1)*, i8 addrspace(1)** %C.addr, align 8, !tbaa !22
store i8 %0, i8 addrspace(1)* %1, align 1, !tbaa !14
- %2 = load i32 addrspace(1)* getelementptr inbounds (%struct.my_struct_t addrspace(1)* @var, i32 0, i32 1), align 4, !tbaa !21
- %3 = load i32 addrspace(1)** %I.addr, align 8, !tbaa !22
+ %2 = load i32, i32 addrspace(1)* getelementptr inbounds (%struct.my_struct_t, %struct.my_struct_t addrspace(1)* @var, i32 0, i32 1), align 4, !tbaa !21
+ %3 = load i32 addrspace(1)*, i32 addrspace(1)** %I.addr, align 8, !tbaa !22
store i32 %2, i32 addrspace(1)* %3, align 4, !tbaa !17
ret void
}
diff --git a/test/simple.ll b/test/simple.ll
index 28ebb0f..ff4d26b 100644
--- a/test/simple.ll
+++ b/test/simple.ll
@@ -15,19 +15,19 @@ entry:
store i32 addrspace(1)* %a, i32 addrspace(1)** %a.addr, align 8
store i32 addrspace(1)* %b, i32 addrspace(1)** %b.addr, align 8
store i32 %c, i32* %c.addr, align 4
- %0 = load i32 addrspace(1)** %b.addr, align 8
- %arrayidx = getelementptr inbounds i32 addrspace(1)* %0, i64 0
- %1 = load i32 addrspace(1)* %arrayidx, align 4
- %2 = load i32 addrspace(1)** %a.addr, align 8
- %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %2, i64 0
+ %0 = load i32 addrspace(1)*, i32 addrspace(1)** %b.addr, align 8
+ %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %0, i64 0
+ %1 = load i32, i32 addrspace(1)* %arrayidx, align 4
+ %2 = load i32 addrspace(1)*, i32 addrspace(1)** %a.addr, align 8
+ %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %2, i64 0
store i32 %1, i32 addrspace(1)* %arrayidx1, align 4
- %3 = load i32 addrspace(1)** %b.addr, align 8
+ %3 = load i32 addrspace(1)*, i32 addrspace(1)** %b.addr, align 8
%cmp = icmp ugt i32 addrspace(1)* %3, null
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
- %4 = load i32 addrspace(1)** %a.addr, align 8
- %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %4, i64 0
+ %4 = load i32 addrspace(1)*, i32 addrspace(1)** %a.addr, align 8
+ %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %4, i64 0
store i32 2, i32 addrspace(1)* %arrayidx2, align 4
br label %if.end
@@ -45,15 +45,15 @@ entry:
store double addrspace(1)* %a, double addrspace(1)** %a.addr, align 8
store double addrspace(1)* %b, double addrspace(1)** %b.addr, align 8
store i32 %c, i32* %c.addr, align 4
- %0 = load i32* %c.addr, align 4
+ %0 = load i32, i32* %c.addr, align 4
%idxprom = sext i32 %0 to i64
- %1 = load double addrspace(1)** %b.addr, align 8
- %arrayidx = getelementptr inbounds double addrspace(1)* %1, i64 %idxprom
- %2 = load double addrspace(1)* %arrayidx, align 8
- %3 = load i32* %c.addr, align 4
+ %1 = load double addrspace(1)*, double addrspace(1)** %b.addr, align 8
+ %arrayidx = getelementptr inbounds double, double addrspace(1)* %1, i64 %idxprom
+ %2 = load double, double addrspace(1)* %arrayidx, align 8
+ %3 = load i32, i32* %c.addr, align 4
%idxprom1 = sext i32 %3 to i64
- %4 = load double addrspace(1)** %a.addr, align 8
- %arrayidx2 = getelementptr inbounds double addrspace(1)* %4, i64 %idxprom1
+ %4 = load double addrspace(1)*, double addrspace(1)** %a.addr, align 8
+ %arrayidx2 = getelementptr inbounds double, double addrspace(1)* %4, i64 %idxprom1
store double %2, double addrspace(1)* %arrayidx2, align 8
ret void
}
@@ -70,16 +70,16 @@ entry:
%call = call spir_func i64 @_Z13get_global_idj(i32 0) #2
%conv = trunc i64 %call to i32
store i32 %conv, i32* %n, align 4
- %0 = load i32* %n, align 4
+ %0 = load i32, i32* %n, align 4
%idxprom = sext i32 %0 to i64
- %1 = load i32 addrspace(1)** %in.addr, align 8
- %arrayidx = getelementptr inbounds i32 addrspace(1)* %1, i64 %idxprom
- %2 = load i32 addrspace(1)* %arrayidx, align 4
+ %1 = load i32 addrspace(1)*, i32 addrspace(1)** %in.addr, align 8
+ %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %1, i64 %idxprom
+ %2 = load i32, i32 addrspace(1)* %arrayidx, align 4
%call1 = call spir_func i32 @_Z3absi(i32 %2) #2
- %3 = load i32* %n, align 4
+ %3 = load i32, i32* %n, align 4
%idxprom2 = sext i32 %3 to i64
- %4 = load i32 addrspace(1)** %out.addr, align 8
- %arrayidx3 = getelementptr inbounds i32 addrspace(1)* %4, i64 %idxprom2
+ %4 = load i32 addrspace(1)*, i32 addrspace(1)** %out.addr, align 8
+ %arrayidx3 = getelementptr inbounds i32, i32 addrspace(1)* %4, i64 %idxprom2
store i32 %call1, i32 addrspace(1)* %arrayidx3, align 4
ret void
}
@@ -98,7 +98,7 @@ define spir_func i32 @myabs(i32 %x) #0 {
entry:
%x.addr = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4
- %0 = load i32* %x.addr, align 4
+ %0 = load i32, i32* %x.addr, align 4
%call = call spir_func i32 @_Z3absi(i32 %0) #2
ret i32 %call
}
@@ -115,16 +115,16 @@ entry:
%call = call spir_func i64 @_Z13get_global_idj(i32 0) #2
%conv = trunc i64 %call to i32
store i32 %conv, i32* %n, align 4
- %0 = load i32* %n, align 4
+ %0 = load i32, i32* %n, align 4
%idxprom = sext i32 %0 to i64
- %1 = load i32 addrspace(1)** %in.addr, align 8
- %arrayidx = getelementptr inbounds i32 addrspace(1)* %1, i64 %idxprom
- %2 = load i32 addrspace(1)* %arrayidx, align 4
+ %1 = load i32 addrspace(1)*, i32 addrspace(1)** %in.addr, align 8
+ %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %1, i64 %idxprom
+ %2 = load i32, i32 addrspace(1)* %arrayidx, align 4
%call1 = call spir_func i32 @myabs(i32 %2)
- %3 = load i32* %n, align 4
+ %3 = load i32, i32* %n, align 4
%idxprom2 = sext i32 %3 to i64
- %4 = load i32 addrspace(1)** %out.addr, align 8
- %arrayidx3 = getelementptr inbounds i32 addrspace(1)* %4, i64 %idxprom2
+ %4 = load i32 addrspace(1)*, i32 addrspace(1)** %out.addr, align 8
+ %arrayidx3 = getelementptr inbounds i32, i32 addrspace(1)* %4, i64 %idxprom2
store i32 %call1, i32 addrspace(1)* %arrayidx3, align 4
ret void
}
diff --git a/test/store.ll b/test/store.ll
index 7da3cc4..1d6ed1d 100644
--- a/test/store.ll
+++ b/test/store.ll
@@ -9,7 +9,7 @@ define spir_kernel void @foo(i32 addrspace(1)* %a) #0 {
entry:
%a.addr = alloca i32 addrspace(1)*, align 4
store i32 addrspace(1)* %a, i32 addrspace(1)** %a.addr, align 4
- %0 = load i32 addrspace(1)** %a.addr, align 4
+ %0 = load i32 addrspace(1)*, i32 addrspace(1)** %a.addr, align 4
; CHECK: 5 Store {{[0-9]+}} {{[0-9]+}} 2 4
store i32 0, i32 addrspace(1)* %0, align 4
ret void
diff --git a/test/transcoding/AtomicCompareExchangeExplicit_cl20.ll b/test/transcoding/AtomicCompareExchangeExplicit_cl20.ll
index 567af56..7b737ad 100644
--- a/test/transcoding/AtomicCompareExchangeExplicit_cl20.ll
+++ b/test/transcoding/AtomicCompareExchangeExplicit_cl20.ll
@@ -44,10 +44,10 @@
;CHECK-SPIRV: AtomicCompareExchangeWeak {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} [[DeviceScope]] [[ReleaseMemSem]] [[RelaxedMemSem]]
;CHECK-SPIRV: AtomicCompareExchangeWeak {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} [[WorkgroupScope]] [[AcqRelMemSem]] [[RelaxedMemSem]]
-;CHECK-LLVM: call spir_func i1 @_Z39atomic_compare_exchange_strong_explicitPVU3AS4U7_AtomiciPiiiii(i32 addrspace(4)* %0, i32* %expected1, i32 %desired, i32 2, i32 0, i32 2)
-;CHECK-LLVM: call spir_func i1 @_Z39atomic_compare_exchange_strong_explicitPVU3AS4U7_AtomiciPiiiii(i32 addrspace(4)* %0, i32* %expected2, i32 %desired, i32 3, i32 0, i32 1)
-;CHECK-LLVM: call spir_func i1 @_Z37atomic_compare_exchange_weak_explicitPVU3AS4U7_AtomiciPiiiii(i32 addrspace(4)* %0, i32* %expected3, i32 %desired, i32 2, i32 0, i32 2)
-;CHECK-LLVM: call spir_func i1 @_Z37atomic_compare_exchange_weak_explicitPVU3AS4U7_AtomiciPiiiii(i32 addrspace(4)* %0, i32* %expected4, i32 %desired, i32 3, i32 0, i32 1)
+;CHECK-LLVM: call spir_func i1 @_Z39atomic_compare_exchange_strong_explicitPVU3AS4U7_AtomiciPii12memory_orderS3_12memory_scope(i32 addrspace(4)* %0, i32* %expected1, i32 %desired, i32 2, i32 0, i32 2)
+;CHECK-LLVM: call spir_func i1 @_Z39atomic_compare_exchange_strong_explicitPVU3AS4U7_AtomiciPii12memory_orderS3_12memory_scope(i32 addrspace(4)* %0, i32* %expected2, i32 %desired, i32 3, i32 0, i32 1)
+;CHECK-LLVM: call spir_func i1 @_Z37atomic_compare_exchange_weak_explicitPVU3AS4U7_AtomiciPii12memory_orderS3_12memory_scope(i32 addrspace(4)* %0, i32* %expected3, i32 %desired, i32 2, i32 0, i32 2)
+;CHECK-LLVM: call spir_func i1 @_Z37atomic_compare_exchange_weak_explicitPVU3AS4U7_AtomiciPii12memory_orderS3_12memory_scope(i32 addrspace(4)* %0, i32* %expected4, i32 %desired, i32 3, i32 0, i32 1)
target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir"
diff --git a/test/transcoding/AtomicCompareExchange_cl20.ll b/test/transcoding/AtomicCompareExchange_cl20.ll
index 45cf25d..e0f57bc 100644
--- a/test/transcoding/AtomicCompareExchange_cl20.ll
+++ b/test/transcoding/AtomicCompareExchange_cl20.ll
@@ -16,14 +16,14 @@ target triple = "spir-unknown-unknown"
; CHECK: [[PTR_STRONG:%expected[0-9]*]] = alloca i32, align 4
; CHECK: store i32 {{.*}}, i32* [[PTR_STRONG]]
; CHECK: call spir_func i1 @_Z39atomic_compare_exchange_strong_explicit{{.*}}(i32 {{.*}}* %object, i32* [[PTR_STRONG]], i32 %desired, i32 4, i32 4, i32 2)
-; CHECK: load i32* [[PTR_STRONG]]
+; CHECK: load i32, i32* [[PTR_STRONG]]
; CHECK-LABEL: define spir_func void @test_weak
; CHECK-NEXT: entry:
; CHECK: [[PTR_WEAK:%expected[0-9]*]] = alloca i32, align 4
; CHECK: store i32 {{.*}}, i32* [[PTR_WEAK]]
-; CHECK: call spir_func i1 @_Z37atomic_compare_exchange_weak_explicitPVU3AS4U7_AtomiciPiiiii{{.*}}(i32 {{.*}}* %object, i32* [[PTR_WEAK]], i32 %desired, i32 4, i32 4, i32 2)
-; CHECK: load i32* [[PTR_WEAK]]
+; CHECK: call spir_func i1 @_Z37atomic_compare_exchange_weak_explicitPVU3AS4U7_AtomiciPii12memory_orderS3_12memory_scope{{.*}}(i32 {{.*}}* %object, i32* [[PTR_WEAK]], i32 %desired, i32 4, i32 4, i32 2)
+; CHECK: load i32, i32* [[PTR_WEAK]]
; Check that alloca for atomic_compare_exchange is being created in the entry block.
@@ -66,23 +66,23 @@ entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
- %0 = load i32* %i, align 4
+ %0 = load i32, i32* %i, align 4
%cmp = icmp slt i32 %0, 100000
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
- %1 = load i32 addrspace(1)** %destMemory.addr, align 8
- %arrayidx = getelementptr inbounds i32 addrspace(1)* %1, i64 0
+ %1 = load i32 addrspace(1)*, i32 addrspace(1)** %destMemory.addr, align 8
+ %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %1, i64 0
%2 = addrspacecast i32 addrspace(1)* %arrayidx to i32 addrspace(4)*
%3 = addrspacecast i32* %expected to i32 addrspace(4)*
- %4 = load i32 addrspace(1)** %oldValues.addr, align 8
- %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %4, i64 0
- %5 = load i32 addrspace(1)* %arrayidx1, align 4
+ %4 = load i32 addrspace(1)*, i32 addrspace(1)** %oldValues.addr, align 8
+ %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %4, i64 0
+ %5 = load i32, i32 addrspace(1)* %arrayidx1, align 4
%call = call spir_func zeroext i1 @_Z30atomic_compare_exchange_strongPVU3AS4U7_AtomiciPU3AS4ii(i32 addrspace(4)* %2, i32 addrspace(4)* %3, i32 %5)
br label %for.inc
for.inc: ; preds = %for.body
- %6 = load i32* %i, align 4
+ %6 = load i32, i32* %i, align 4
%inc = add nsw i32 %6, 1
store i32 %inc, i32* %i, align 4
br label %for.cond
diff --git a/test/transcoding/BuildNDRange_2.ll b/test/transcoding/BuildNDRange_2.ll
index 529c153..e45d836 100644
--- a/test/transcoding/BuildNDRange_2.ll
+++ b/test/transcoding/BuildNDRange_2.ll
@@ -70,11 +70,11 @@ entry:
%tmp3 = alloca %struct.ndrange_t, align 8
%0 = bitcast [2 x i64]* %lsize2 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ([2 x i64]* @test_ndrange_2D3D.lsize2 to i8*), i64 16, i32 8, i1 false)
- %arraydecay = getelementptr inbounds [2 x i64]* %lsize2, i64 0, i64 0
+ %arraydecay = getelementptr inbounds [2 x i64], [2 x i64]* %lsize2, i64 0, i64 0
call spir_func void @_Z10ndrange_2DPKm(%struct.ndrange_t* sret %tmp, i64* %arraydecay) #2
%1 = bitcast [3 x i64]* %lsize3 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* bitcast ([3 x i64]* @test_ndrange_2D3D.lsize3 to i8*), i64 24, i32 8, i1 false)
- %arraydecay2 = getelementptr inbounds [3 x i64]* %lsize3, i64 0, i64 0
+ %arraydecay2 = getelementptr inbounds [3 x i64], [3 x i64]* %lsize3, i64 0, i64 0
call spir_func void @_Z10ndrange_3DPKm(%struct.ndrange_t* sret %tmp3, i64* %arraydecay2) #2
ret void
}
@@ -91,8 +91,8 @@ define spir_func void @test_ndrange_const_2D3D() #0 {
entry:
%tmp = alloca %struct.ndrange_t, align 8
%tmp1 = alloca %struct.ndrange_t, align 8
- call spir_func void @_Z10ndrange_2DPKm(%struct.ndrange_t* sret %tmp, i64* getelementptr inbounds ([2 x i64]* @test_ndrange_2D3D.lsize2, i64 0, i64 0)) #2
- call spir_func void @_Z10ndrange_3DPKm(%struct.ndrange_t* sret %tmp1, i64* getelementptr inbounds ([3 x i64]* @test_ndrange_2D3D.lsize3, i64 0, i64 0)) #2
+ call spir_func void @_Z10ndrange_2DPKm(%struct.ndrange_t* sret %tmp, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @test_ndrange_2D3D.lsize2, i64 0, i64 0)) #2
+ call spir_func void @_Z10ndrange_3DPKm(%struct.ndrange_t* sret %tmp1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @test_ndrange_2D3D.lsize3, i64 0, i64 0)) #2
ret void
}
diff --git a/test/transcoding/OpConstantBool.ll b/test/transcoding/OpConstantBool.ll
index ef83069..daca015 100644
--- a/test/transcoding/OpConstantBool.ll
+++ b/test/transcoding/OpConstantBool.ll
@@ -25,7 +25,7 @@ entry:
store i32 addrspace(1)* %i, i32 addrspace(1)** %i.addr, align 4
%call = call spir_func zeroext i1 @f()
%conv = zext i1 %call to i32
- %0 = load i32 addrspace(1)** %i.addr, align 4
+ %0 = load i32 addrspace(1)*, i32 addrspace(1)** %i.addr, align 4
store i32 %conv, i32 addrspace(1)* %0, align 4
ret void
}
diff --git a/test/transcoding/OpGenericPtrMemSemantics.ll b/test/transcoding/OpGenericPtrMemSemantics.ll
index d603d7b..0f3d332 100644
--- a/test/transcoding/OpGenericPtrMemSemantics.ll
+++ b/test/transcoding/OpGenericPtrMemSemantics.ll
@@ -32,7 +32,7 @@ entry:
%0 = bitcast i32 addrspace(4)* %ptr to i8 addrspace(4)*
%call = tail call spir_func i32 @_Z9get_fencePU3AS4v(i8 addrspace(4)* %0) #3
%switch.i = icmp ult i32 %call, 4
- %1 = load i32 addrspace(4)* %ptr, align 4
+ %1 = load i32, i32 addrspace(4)* %ptr, align 4
%cmp = icmp eq i32 %1, %val
%and4 = and i1 %switch.i, %cmp
%and = zext i1 %and4 to i32
@@ -46,14 +46,14 @@ declare spir_func i32 @_Z9get_fencePU3AS4v(i8 addrspace(4)*) #2
define spir_kernel void @testKernel(i32 addrspace(1)* nocapture %results) #1 {
entry:
%call = tail call spir_func i32 @_Z13get_global_idj(i32 0) #3
- %0 = load i32 addrspace(1)* @gint, align 4
+ %0 = load i32, i32 addrspace(1)* @gint, align 4
%call.i = tail call spir_func i32 @_Z9get_fencePU3AS4v(i8 addrspace(4)* addrspacecast (i8 addrspace(1)* bitcast (i32 addrspace(1)* @gint to i8 addrspace(1)*) to i8 addrspace(4)*)) #3
%switch.i.i = icmp ult i32 %call.i, 4
- %1 = load i32 addrspace(4)* addrspacecast (i32 addrspace(1)* @gint to i32 addrspace(4)*), align 4
+ %1 = load i32, i32 addrspace(4)* addrspacecast (i32 addrspace(1)* @gint to i32 addrspace(4)*), align 4
%cmp.i = icmp eq i32 %1, %0
%and4.i = and i1 %switch.i.i, %cmp.i
%cond = zext i1 %and4.i to i32
- %arrayidx = getelementptr inbounds i32 addrspace(1)* %results, i32 %call
+ %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %results, i32 %call
store i32 %cond, i32 addrspace(1)* %arrayidx, align 4
ret void
}
diff --git a/test/transcoding/OpGroupAsyncCopy.ll b/test/transcoding/OpGroupAsyncCopy.ll
index 5eafb0b..7c23a55 100644
--- a/test/transcoding/OpGroupAsyncCopy.ll
+++ b/test/transcoding/OpGroupAsyncCopy.ll
@@ -34,24 +34,24 @@ entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
- %0 = load i32* %i, align 4
- %1 = load i32* %copiesPerWorkItem.addr, align 4
+ %0 = load i32, i32* %i, align 4
+ %1 = load i32, i32* %copiesPerWorkItem.addr, align 4
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
%call = call spir_func i32 @_Z12get_local_idj(i32 0)
- %2 = load i32* %copiesPerWorkItem.addr, align 4
+ %2 = load i32, i32* %copiesPerWorkItem.addr, align 4
%mul = mul i32 %call, %2
- %3 = load i32* %i, align 4
+ %3 = load i32, i32* %i, align 4
%add = add i32 %mul, %3
- %4 = load <2 x i8> addrspace(3)** %localBuffer.addr, align 4
- %arrayidx = getelementptr inbounds <2 x i8> addrspace(3)* %4, i32 %add
+ %4 = load <2 x i8> addrspace(3)*, <2 x i8> addrspace(3)** %localBuffer.addr, align 4
+ %arrayidx = getelementptr inbounds <2 x i8>, <2 x i8> addrspace(3)* %4, i32 %add
store <2 x i8> zeroinitializer, <2 x i8> addrspace(3)* %arrayidx, align 2
br label %for.inc
for.inc: ; preds = %for.body
- %5 = load i32* %i, align 4
+ %5 = load i32, i32* %i, align 4
%inc = add nsw i32 %5, 1
store i32 %inc, i32* %i, align 4
br label %for.cond
@@ -62,45 +62,45 @@ for.end: ; preds = %for.cond
br label %for.cond1
for.cond1: ; preds = %for.inc12, %for.end
- %6 = load i32* %i, align 4
- %7 = load i32* %copiesPerWorkItem.addr, align 4
+ %6 = load i32, i32* %i, align 4
+ %7 = load i32, i32* %copiesPerWorkItem.addr, align 4
%cmp2 = icmp slt i32 %6, %7
br i1 %cmp2, label %for.body3, label %for.end14
for.body3: ; preds = %for.cond1
%call4 = call spir_func i32 @_Z13get_global_idj(i32 0)
- %8 = load i32* %copiesPerWorkItem.addr, align 4
+ %8 = load i32, i32* %copiesPerWorkItem.addr, align 4
%mul5 = mul i32 %call4, %8
- %9 = load i32* %i, align 4
+ %9 = load i32, i32* %i, align 4
%add6 = add i32 %mul5, %9
- %10 = load <2 x i8> addrspace(1)** %src.addr, align 4
- %arrayidx7 = getelementptr inbounds <2 x i8> addrspace(1)* %10, i32 %add6
- %11 = load <2 x i8> addrspace(1)* %arrayidx7, align 2
+ %10 = load <2 x i8> addrspace(1)*, <2 x i8> addrspace(1)** %src.addr, align 4
+ %arrayidx7 = getelementptr inbounds <2 x i8>, <2 x i8> addrspace(1)* %10, i32 %add6
+ %11 = load <2 x i8>, <2 x i8> addrspace(1)* %arrayidx7, align 2
%call8 = call spir_func i32 @_Z12get_local_idj(i32 0)
- %12 = load i32* %copiesPerWorkItem.addr, align 4
+ %12 = load i32, i32* %copiesPerWorkItem.addr, align 4
%mul9 = mul i32 %call8, %12
- %13 = load i32* %i, align 4
+ %13 = load i32, i32* %i, align 4
%add10 = add i32 %mul9, %13
- %14 = load <2 x i8> addrspace(3)** %localBuffer.addr, align 4
- %arrayidx11 = getelementptr inbounds <2 x i8> addrspace(3)* %14, i32 %add10
+ %14 = load <2 x i8> addrspace(3)*, <2 x i8> addrspace(3)** %localBuffer.addr, align 4
+ %arrayidx11 = getelementptr inbounds <2 x i8>, <2 x i8> addrspace(3)* %14, i32 %add10
store <2 x i8> %11, <2 x i8> addrspace(3)* %arrayidx11, align 2
br label %for.inc12
for.inc12: ; preds = %for.body3
- %15 = load i32* %i, align 4
+ %15 = load i32, i32* %i, align 4
%inc13 = add nsw i32 %15, 1
store i32 %inc13, i32* %i, align 4
br label %for.cond1
for.end14: ; preds = %for.cond1
call spir_func void @_Z7barrierj(i32 1)
- %16 = load <2 x i8> addrspace(1)** %dst.addr, align 4
- %17 = load i32* %copiesPerWorkgroup.addr, align 4
+ %16 = load <2 x i8> addrspace(1)*, <2 x i8> addrspace(1)** %dst.addr, align 4
+ %17 = load i32, i32* %copiesPerWorkgroup.addr, align 4
%call15 = call spir_func i32 @_Z12get_group_idj(i32 0)
%mul16 = mul i32 %17, %call15
- %add.ptr = getelementptr inbounds <2 x i8> addrspace(1)* %16, i32 %mul16
- %18 = load <2 x i8> addrspace(3)** %localBuffer.addr, align 4
- %19 = load i32* %copiesPerWorkgroup.addr, align 4
+ %add.ptr = getelementptr inbounds <2 x i8>, <2 x i8> addrspace(1)* %16, i32 %mul16
+ %18 = load <2 x i8> addrspace(3)*, <2 x i8> addrspace(3)** %localBuffer.addr, align 4
+ %19 = load i32, i32* %copiesPerWorkgroup.addr, align 4
%call17 = call spir_func %opencl.event_t* @_Z21async_work_group_copyPU3AS1Dv2_cPKU3AS3S_j9ocl_event(<2 x i8> addrspace(1)* %add.ptr, <2 x i8> addrspace(3)* %18, i32 %19, %opencl.event_t* null)
store %opencl.event_t* %call17, %opencl.event_t** %event, align 4
%20 = addrspacecast %opencl.event_t** %event to %opencl.event_t* addrspace(4)*
diff --git a/test/transcoding/OpImageReadMS.ll b/test/transcoding/OpImageReadMS.ll
index dcc48ed..6e899a5 100644
--- a/test/transcoding/OpImageReadMS.ll
+++ b/test/transcoding/OpImageReadMS.ll
@@ -37,7 +37,7 @@ for.body: ; preds = %for.body.lr.ph, %fo
%tmp19 = mul i32 %tmp, %call2
%add7 = add i32 %tmp19, %call
%call9 = tail call spir_func <4 x float> @_Z11read_imagef15ocl_image2dmsaaDv2_ii(%opencl.image2d_msaa_t addrspace(1)* %source, <2 x i32> %vecinit8, i32 %sample.021) #2
- %arrayidx = getelementptr inbounds <4 x float> addrspace(1)* %results, i32 %add7
+ %arrayidx = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %results, i32 %add7
store <4 x float> %call9, <4 x float> addrspace(1)* %arrayidx, align 16
%inc = add nuw i32 %sample.021, 1
%cmp = icmp ult i32 %inc, %call4
diff --git a/test/transcoding/OpImageSampleExplicitLod.ll b/test/transcoding/OpImageSampleExplicitLod.ll
index 7a409ea..9c14547 100644
--- a/test/transcoding/OpImageSampleExplicitLod.ll
+++ b/test/transcoding/OpImageSampleExplicitLod.ll
@@ -25,16 +25,16 @@ entry:
%call2.old = extractelement <2 x i32> %call2.tmp1, i32 0
%mul = mul i32 %call1, %call2.old
%add = add i32 %mul, %call
- %arrayidx = getelementptr inbounds float addrspace(1)* %xOffsets, i32 %add
- %0 = load float addrspace(1)* %arrayidx, align 4
+ %arrayidx = getelementptr inbounds float, float addrspace(1)* %xOffsets, i32 %add
+ %0 = load float, float addrspace(1)* %arrayidx, align 4
%conv = fptosi float %0 to i32
%vecinit = insertelement <2 x i32> undef, i32 %conv, i32 0
- %arrayidx3 = getelementptr inbounds float addrspace(1)* %yOffsets, i32 %add
- %1 = load float addrspace(1)* %arrayidx3, align 4
+ %arrayidx3 = getelementptr inbounds float, float addrspace(1)* %yOffsets, i32 %add
+ %1 = load float, float addrspace(1)* %arrayidx3, align 4
%conv4 = fptosi float %1 to i32
%vecinit5 = insertelement <2 x i32> %vecinit, i32 %conv4, i32 1
%call6.tmp.tmp = call spir_func float @_Z11read_imagef16ocl_image2ddepth11ocl_samplerDv2_i(%opencl.image2d_depth_t addrspace(1)* %input, i32 %imageSampler, <2 x i32> %vecinit5)
- %arrayidx7 = getelementptr inbounds float addrspace(1)* %results, i32 %add
+ %arrayidx7 = getelementptr inbounds float, float addrspace(1)* %results, i32 %add
store float %call6.tmp.tmp, float addrspace(1)* %arrayidx7, align 4
ret void
}
diff --git a/test/transcoding/OpMemoryBarrier_cl20.ll b/test/transcoding/OpMemoryBarrier_cl20.ll
index 4b928a2..f9327f3 100644
--- a/test/transcoding/OpMemoryBarrier_cl20.ll
+++ b/test/transcoding/OpMemoryBarrier_cl20.ll
@@ -5,20 +5,20 @@
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
-; CHECK-LLVM: call spir_func void @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 0)
-; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 1)
-; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 2)
-; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 3)
-
-; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 0)
-; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 1)
-; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 2)
-; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 3)
-
-; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 0)
-; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 1)
-; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 2)
-; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 3)
+; CHECK-LLVM: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 2, i32 3, i32 0)
+; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 2, i32 3, i32 1)
+; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 2, i32 3, i32 2)
+; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 2, i32 3, i32 3)
+
+; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 1, i32 3, i32 0)
+; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 1, i32 3, i32 1)
+; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 1, i32 3, i32 2)
+; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 1, i32 3, i32 3)
+
+; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 4, i32 3, i32 0)
+; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 4, i32 3, i32 1)
+; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 4, i32 3, i32 2)
+; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencej12memory_order12memory_scope(i32 4, i32 3, i32 3)
; global | acquire_release
; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema1:[0-9]+]] 520
diff --git a/test/transcoding/OpPhi_ArgumentsPlaceholders.ll b/test/transcoding/OpPhi_ArgumentsPlaceholders.ll
index 8bfa625..8666e44 100644
--- a/test/transcoding/OpPhi_ArgumentsPlaceholders.ll
+++ b/test/transcoding/OpPhi_ArgumentsPlaceholders.ll
@@ -42,13 +42,13 @@ for.cond: ; preds = %for.inc, %entry
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
- %pNext = getelementptr inbounds %struct.Node addrspace(1)* %pNode.0, i32 0, i32 0
+ %pNext = getelementptr inbounds %struct.Node, %struct.Node addrspace(1)* %pNode.0, i32 0, i32 0
- %0 = load %struct.Node.0 addrspace(1)* addrspace(1)* %pNext, align 4
+ %0 = load %struct.Node.0 addrspace(1)*, %struct.Node.0 addrspace(1)* addrspace(1)* %pNext, align 4
%1 = bitcast %struct.Node.0 addrspace(1)* %0 to %struct.Node addrspace(1)*
;CHECK-SPIRV: Load {{[0-9]+}} [[LoadResultId:[0-9]+]]
;CHECK-SPIRV: Bitcast {{[0-9]+}} [[BitcastResultId]] [[LoadResultId]]
-;CHECK-LLVM: [[LoadResult:%[0-9]+]] = load %struct.Node.0 addrspace(1)* addrspace(1)* {{.*}}
+;CHECK-LLVM: [[LoadResult:%[0-9]+]] = load %struct.Node.0 addrspace(1)*, %struct.Node.0 addrspace(1)* addrspace(1)* {{.*}}
;CHECK-LLVM: [[BitcastResult]] = bitcast %struct.Node.0 addrspace(1)* [[LoadResult]] to %struct.Node addrspace(1)*
br label %for.inc
diff --git a/test/transcoding/atomic_store.ll b/test/transcoding/atomic_store.ll
index 38ef75f..37617ff 100644
--- a/test/transcoding/atomic_store.ll
+++ b/test/transcoding/atomic_store.ll
@@ -15,7 +15,7 @@ target triple = "spir-unknown-unknown"
; CHECK-LLVM: define spir_func void @test
; CHECK-LLVM-LABEL: entry
-; CHECK-LLVM: call spir_func void @_Z21atomic_store_explicitPVU3AS4U7_Atomiciiii(i32 addrspace(4)* %object, i32 %desired, i32 4, i32 2)
+; CHECK-LLVM: call spir_func void @_Z21atomic_store_explicitPVU3AS4U7_Atomicii12memory_order12memory_scope(i32 addrspace(4)* %object, i32 %desired, i32 4, i32 2)
; CHECK-SPIRV-LABEL: 5 Function
; CHECK-SPIRV-NEXT: FunctionParameter {{[0-9]+}} [[object:[0-9]+]]
diff --git a/test/transcoding/atomics_1.2.ll b/test/transcoding/atomics_1.2.ll
index cfa2434..6817556 100644
--- a/test/transcoding/atomics_1.2.ll
+++ b/test/transcoding/atomics_1.2.ll
@@ -17,51 +17,51 @@ target triple = "spir64-unknown-unknown"
define spir_kernel void @test_atomic_global(i32 addrspace(1)* %dst) #0 {
; atomic_inc
%inc_ig = tail call spir_func i32 @_Z10atomic_incPVU3AS1i(i32 addrspace(1)* %dst) #0
- ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS1U7_Atomiciiii(i32 addrspace(1)* {{.*}}, i32 1
+ ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope(i32 addrspace(1)* {{.*}}, i32 1
%dec_jg = tail call spir_func i32 @_Z10atomic_decPVU3AS1j(i32 addrspace(1)* %dst) #0
- ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS1U7_Atomiciiii(i32 addrspace(1)* {{.*}}, i32 1
+ ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope(i32 addrspace(1)* {{.*}}, i32 1
; atomic_max
%max_ig = tail call spir_func i32 @_Z10atomic_maxPVU3AS1ii(i32 addrspace(1)* %dst, i32 0) #0
- ; CHECK: _Z25atomic_fetch_max_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_max_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
%max_jg = tail call spir_func i32 @_Z10atomic_maxPVU3AS1jj(i32 addrspace(1)* %dst, i32 0) #0
- ; CHECK: _Z25atomic_fetch_max_explicitPVU3AS1U7_Atomicjjii
+ ; CHECK: _Z25atomic_fetch_max_explicitPVU3AS1U7_Atomicjj12memory_order12memory_scope
; atomic_min
%min_ig = tail call spir_func i32 @_Z10atomic_minPVU3AS1ii(i32 addrspace(1)* %dst, i32 0) #0
- ; CHECK: _Z25atomic_fetch_min_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_min_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
%min_jg = tail call spir_func i32 @_Z10atomic_minPVU3AS1jj(i32 addrspace(1)* %dst, i32 0) #0
- ; CHECK: _Z25atomic_fetch_min_explicitPVU3AS1U7_Atomicjjii
+ ; CHECK: _Z25atomic_fetch_min_explicitPVU3AS1U7_Atomicjj12memory_order12memory_scope
; atomic_add
%add_ig = tail call spir_func i32 @_Z10atomic_addPVU3AS1ii(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
%add_jg = tail call spir_func i32 @_Z10atomic_addPVU3AS1jj(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
; atomic_sub
%sub_ig = tail call spir_func i32 @_Z10atomic_subPVU3AS1ii(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
%sub_jg = tail call spir_func i32 @_Z10atomic_subPVU3AS1jj(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
; atomic_or
%or_ig = tail call spir_func i32 @_Z9atomic_orPVU3AS1ii(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z24atomic_fetch_or_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z24atomic_fetch_or_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
%or_jg = tail call spir_func i32 @_Z9atomic_orPVU3AS1jj(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z24atomic_fetch_or_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z24atomic_fetch_or_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
; atomic_xor
%xor_ig = tail call spir_func i32 @_Z10atomic_xorPVU3AS1ii(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_xor_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_xor_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
%xor_jg = tail call spir_func i32 @_Z10atomic_xorPVU3AS1jj(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_xor_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_xor_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
; atomic_and
%and_ig = tail call spir_func i32 @_Z10atomic_andPVU3AS1ii(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_and_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_and_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
%and_jg = tail call spir_func i32 @_Z10atomic_andPVU3AS1jj(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_and_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_and_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
; atomic_cmpxchg
%cmpxchg_ig = call spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(i32 addrspace(1)* %dst, i32 0, i32 1) #0
@@ -71,9 +71,9 @@ define spir_kernel void @test_atomic_global(i32 addrspace(1)* %dst) #0 {
; atomic_xchg
%xchg_ig = call spir_func i32 @_Z11atomic_xchgPVU3AS1ii(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z24atomic_exchange_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z24atomic_exchange_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
%xchg_jg = call spir_func i32 @_Z11atomic_xchgPVU3AS1jj(i32 addrspace(1)* %dst, i32 1) #0
- ; CHECK: _Z24atomic_exchange_explicitPVU3AS1U7_Atomiciiii
+ ; CHECK: _Z24atomic_exchange_explicitPVU3AS1U7_Atomicii12memory_order12memory_scope
ret void
}
@@ -81,65 +81,65 @@ define spir_kernel void @test_atomic_global(i32 addrspace(1)* %dst) #0 {
define spir_kernel void @test_atomic_local(i32 addrspace(3)* %dst) #0 {
; atomic_inc
%inc_il = tail call spir_func i32 @_Z10atomic_incPVU3AS3i(i32 addrspace(3)* %dst) #0
- ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS3U7_Atomiciiii(i32 addrspace(3)* {{.*}}, i32 1
+ ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope(i32 addrspace(3)* {{.*}}, i32 1
; atomic dec
%dec_jl = tail call spir_func i32 @_Z10atomic_decPVU3AS3j(i32 addrspace(3)* %dst) #0
- ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS3U7_Atomiciiii(i32 addrspace(3)* {{.*}}, i32 1
+ ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope(i32 addrspace(3)* {{.*}}, i32 1
; atomic_max
%max_il = tail call spir_func i32 @_Z10atomic_maxPVU3AS3ii(i32 addrspace(3)* %dst, i32 0) #0
- ; CHECK: _Z25atomic_fetch_max_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_max_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
%max_jl = tail call spir_func i32 @_Z10atomic_maxPVU3AS3jj(i32 addrspace(3)* %dst, i32 0) #0
- ; CHECK: _Z25atomic_fetch_max_explicitPVU3AS3U7_Atomicjjii
+ ; CHECK: _Z25atomic_fetch_max_explicitPVU3AS3U7_Atomicjj12memory_order12memory_scope
; atomic_min
%min_il = tail call spir_func i32 @_Z10atomic_minPVU3AS3ii(i32 addrspace(3)* %dst, i32 0) #0
- ; CHECK: _Z25atomic_fetch_min_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_min_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
%min_jl = tail call spir_func i32 @_Z10atomic_minPVU3AS3jj(i32 addrspace(3)* %dst, i32 0) #0
- ; CHECK: _Z25atomic_fetch_min_explicitPVU3AS3U7_Atomicjjii
+ ; CHECK: _Z25atomic_fetch_min_explicitPVU3AS3U7_Atomicjj12memory_order12memory_scope
; atomic_add
%add_il = tail call spir_func i32 @_Z10atomic_addPVU3AS3ii(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
%add_jl = tail call spir_func i32 @_Z10atomic_addPVU3AS3jj(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_add_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
; atomic_sub
%sub_il = tail call spir_func i32 @_Z10atomic_subPVU3AS3ii(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
%sub_jl = tail call spir_func i32 @_Z10atomic_subPVU3AS3jj(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_sub_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
; atomic_or
%or_il = tail call spir_func i32 @_Z9atomic_orPVU3AS3ii(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z24atomic_fetch_or_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z24atomic_fetch_or_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
%or_jl = tail call spir_func i32 @_Z9atomic_orPVU3AS3jj(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z24atomic_fetch_or_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z24atomic_fetch_or_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
; atomic_xor
%xor_il = tail call spir_func i32 @_Z10atomic_xorPVU3AS3ii(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_xor_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_xor_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
%xor_jl = tail call spir_func i32 @_Z10atomic_xorPVU3AS3jj(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_xor_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_xor_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
; atomic_and
%and_il = tail call spir_func i32 @_Z10atomic_andPVU3AS3ii(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_and_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_and_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
%and_jl = tail call spir_func i32 @_Z10atomic_andPVU3AS3jj(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z25atomic_fetch_and_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z25atomic_fetch_and_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
; atomic_cmpxchg
%cmpxchg_il = call spir_func i32 @_Z14atomic_cmpxchgPVU3AS3iii(i32 addrspace(3)* %dst, i32 0, i32 1) #0
- ; CHECK: _Z39atomic_compare_exchange_strong_explicitPVU3AS3U7
+ ; CHECK: _Z39atomic_compare_exchange_strong_explicitPVU3AS3
%cmpxchg_jl = call spir_func i32 @_Z14atomic_cmpxchgPVU3AS3jjj(i32 addrspace(3)* %dst, i32 0, i32 1) #0
; CHECK: _Z39atomic_compare_exchange_strong_explicitPVU3AS3U7
; atomic_xchg
%xchg_il = call spir_func i32 @_Z11atomic_xchgPVU3AS3ii(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z24atomic_exchange_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z24atomic_exchange_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
%xchg_jl = call spir_func i32 @_Z11atomic_xchgPVU3AS3jj(i32 addrspace(3)* %dst, i32 1) #0
- ; CHECK: _Z24atomic_exchange_explicitPVU3AS3U7_Atomiciiii
+ ; CHECK: _Z24atomic_exchange_explicitPVU3AS3U7_Atomicii12memory_order12memory_scope
ret void
}
diff --git a/test/transcoding/bitcast.ll b/test/transcoding/bitcast.ll
index c099a00..be7fa36 100644
--- a/test/transcoding/bitcast.ll
+++ b/test/transcoding/bitcast.ll
@@ -17,10 +17,10 @@ entry:
%call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
%sext = shl i64 %call, 32
%idxprom = ashr exact i64 %sext, 32
- %arrayidx = getelementptr inbounds <2 x i8> addrspace(1)* %src, i64 %idxprom
- %0 = load <2 x i8> addrspace(1)* %arrayidx, align 2, !tbaa !9
+ %arrayidx = getelementptr inbounds <2 x i8>, <2 x i8> addrspace(1)* %src, i64 %idxprom
+ %0 = load <2 x i8>, <2 x i8> addrspace(1)* %arrayidx, align 2, !tbaa !9
%astype = bitcast <2 x i8> %0 to i16
- %arrayidx2 = getelementptr inbounds i16 addrspace(1)* %dst, i64 %idxprom
+ %arrayidx2 = getelementptr inbounds i16, i16 addrspace(1)* %dst, i64 %idxprom
store i16 %astype, i16 addrspace(1)* %arrayidx2, align 2, !tbaa !12
ret void
}
diff --git a/test/transcoding/device_execution.ll b/test/transcoding/device_execution.ll
index 17678a5..f947db3 100644
--- a/test/transcoding/device_execution.ll
+++ b/test/transcoding/device_execution.ll
@@ -39,7 +39,7 @@ target triple = "spir64-unknonw-unknown"
; Function Attrs: nounwind
define spir_kernel void @device_kernel(float addrspace(1)* nocapture %inout) #0 {
entry:
- %0 = load float addrspace(1)* %inout, align 4, !tbaa !11
+ %0 = load float, float addrspace(1)* %inout, align 4, !tbaa !11
%call = tail call spir_func float @_Z3cosf(float %0) #2
store float %call, float addrspace(1)* %inout, align 4, !tbaa !11
ret void
@@ -54,7 +54,7 @@ entry:
%agg.tmp = alloca %struct.ndrange_t, align 8
%call = tail call spir_func %opencl.queue_t* @get_default_queue() #2
call spir_func void @_Z10ndrange_1Dm(%struct.ndrange_t* sret %agg.tmp, i64 1) #2
- %block.captured = getelementptr inbounds <{ float addrspace(1)* }>* %captured, i64 0, i32 0
+ %block.captured = getelementptr inbounds <{ float addrspace(1)* }>, <{ float addrspace(1)* }>* %captured, i64 0, i32 0
store float addrspace(1)* %inout, float addrspace(1)** %block.captured, align 8, !tbaa !15
%0 = bitcast <{ float addrspace(1)* }>* %captured to i8*
%1 = call %opencl.block* @spir_block_bind(i8* bitcast (void (i8*)* @__host_kernel_block_invoke to i8*), i32 8, i32 8, i8* %0) #2
@@ -70,8 +70,8 @@ declare spir_func void @_Z10ndrange_1Dm(%struct.ndrange_t* sret, i64) #1
define internal spir_func void @__host_kernel_block_invoke(i8* nocapture readonly %.block_descriptor) #0 {
entry:
%block.capture.addr = bitcast i8* %.block_descriptor to float addrspace(1)**
- %0 = load float addrspace(1)** %block.capture.addr, align 8, !tbaa !15
- %1 = load float addrspace(1)* %0, align 4, !tbaa !11
+ %0 = load float addrspace(1)*, float addrspace(1)** %block.capture.addr, align 8, !tbaa !15
+ %1 = load float, float addrspace(1)* %0, align 4, !tbaa !11
%call.i = tail call spir_func float @_Z3cosf(float %1) #2
store float %call.i, float addrspace(1)* %0, align 4, !tbaa !11
ret void
diff --git a/test/transcoding/device_execution_multiple_blocks.ll b/test/transcoding/device_execution_multiple_blocks.ll
index 0d7c0d0..69f3707 100644
--- a/test/transcoding/device_execution_multiple_blocks.ll
+++ b/test/transcoding/device_execution_multiple_blocks.ll
@@ -71,7 +71,7 @@ define spir_kernel void @enqueue_block_get_kernel_preferred_work_group_size_mult
entry:
%captured = alloca <{ i32 addrspace(1)* }>, align 8
%ndrange = alloca %struct.ndrange_t, align 8
- %block.captured = getelementptr inbounds <{ i32 addrspace(1)* }>* %captured, i64 0, i32 0
+ %block.captured = getelementptr inbounds <{ i32 addrspace(1)* }>, <{ i32 addrspace(1)* }>* %captured, i64 0, i32 0
store i32 addrspace(1)* %res, i32 addrspace(1)** %block.captured, align 8
%0 = bitcast <{ i32 addrspace(1)* }>* %captured to i8*
; CHECK: [[CTX:.*]] = bitcast %0* %captured to i8*
@@ -101,7 +101,7 @@ entry:
define internal spir_func void @__enqueue_block_get_kernel_preferred_work_group_size_multiple_block_invoke(i8* nocapture readonly %.block_descriptor) #0 {
entry:
%block.capture.addr = bitcast i8* %.block_descriptor to i32 addrspace(1)**
- %0 = load i32 addrspace(1)** %block.capture.addr, align 8
+ %0 = load i32 addrspace(1)*, i32 addrspace(1)** %block.capture.addr, align 8
store i32 2, i32 addrspace(1)* %0, align 4
ret void
}
diff --git a/test/transcoding/device_execution_overloading.ll b/test/transcoding/device_execution_overloading.ll
index 5d4429f..b719bca 100644
--- a/test/transcoding/device_execution_overloading.ll
+++ b/test/transcoding/device_execution_overloading.ll
@@ -53,9 +53,9 @@ entry:
%ptr1.addr = alloca float addrspace(3)*, align 8
store float addrspace(3)* %ptr0, float addrspace(3)** %ptr0.addr, align 8
store float addrspace(3)* %ptr1, float addrspace(3)** %ptr1.addr, align 8
- %0 = load float addrspace(3)** %ptr0.addr, align 8
+ %0 = load float addrspace(3)*, float addrspace(3)** %ptr0.addr, align 8
store float 0.000000e+00, float addrspace(3)* %0, align 4
- %1 = load float addrspace(3)** %ptr1.addr, align 8
+ %1 = load float addrspace(3)*, float addrspace(3)** %ptr1.addr, align 8
store float 1.000000e+00, float addrspace(3)* %1, align 4
ret void
}
@@ -65,7 +65,7 @@ define spir_func void @device_kernel(float addrspace(1)* %ptr) #0 {
entry:
%ptr.addr = alloca float addrspace(1)*, align 8
store float addrspace(1)* %ptr, float addrspace(1)** %ptr.addr, align 8
- %0 = load float addrspace(1)** %ptr.addr, align 8
+ %0 = load float addrspace(1)*, float addrspace(1)** %ptr.addr, align 8
store float 3.000000e+00, float addrspace(1)* %0, align 4
ret void
}
@@ -94,35 +94,35 @@ entry:
store float addrspace(1)* %ptr, float addrspace(1)** %ptr.addr, align 8
%0 = call %opencl.block* @spir_block_bind(i8* bitcast (void (i8*, i8 addrspace(3)*, i8 addrspace(3)*)* @__host_kernel_block_invoke to i8*), i32 0, i32 0, i8* null)
store %opencl.block* %0, %opencl.block** %block_with_local, align 8
- %block.captured = getelementptr inbounds <{ float addrspace(1)* }>* %captured, i32 0, i32 0
- %1 = load float addrspace(1)** %ptr.addr, align 8
+ %block.captured = getelementptr inbounds <{ float addrspace(1)* }>, <{ float addrspace(1)* }>* %captured, i32 0, i32 0
+ %1 = load float addrspace(1)*, float addrspace(1)** %ptr.addr, align 8
store float addrspace(1)* %1, float addrspace(1)** %block.captured, align 8
%2 = bitcast <{ float addrspace(1)* }>* %captured to i8*
%3 = call %opencl.block* @spir_block_bind(i8* bitcast (void (i8*)* @__host_kernel_block_invoke_2 to i8*), i32 8, i32 8, i8* %2)
store %opencl.block* %3, %opencl.block** %block, align 8
- %4 = load %opencl.block** %block_with_local, align 8
+ %4 = load %opencl.block*, %opencl.block** %block_with_local, align 8
%call = call spir_func i32 @_Z26get_kernel_work_group_sizeU13block_pointerFvPU3AS3vzE(%opencl.block* %4)
store i32 %call, i32* %wgSize, align 4
- %5 = load %opencl.block** %block_with_local, align 8
+ %5 = load %opencl.block*, %opencl.block** %block_with_local, align 8
%call2 = call spir_func i32 @_Z45get_kernel_preferred_work_group_size_multipleU13block_pointerFvPU3AS3vzE(%opencl.block* %5)
store i32 %call2, i32* %prefMul, align 4
%call3 = call spir_func %opencl.queue_t* @_Z17get_default_queuev()
call spir_func void @_Z10ndrange_1Dm(%struct.ndrange_t* sret %agg.tmp, i64 1)
- %6 = load %opencl.block** %block_with_local, align 8
- %7 = load i32* %size.addr, align 4
- %8 = load i32* %wgSize, align 4
- %9 = load i32* %prefMul, align 4
+ %6 = load %opencl.block*, %opencl.block** %block_with_local, align 8
+ %7 = load i32, i32* %size.addr, align 4
+ %8 = load i32, i32* %wgSize, align 4
+ %9 = load i32, i32* %prefMul, align 4
%mul = mul i32 %8, %9
- %call4 = call spir_func i32 (%opencl.queue_t*, i32, %struct.ndrange_t*, i32, %opencl.clk_event_t**, %opencl.clk_event_t**, %opencl.block*, i32, ...)* @_Z14enqueue_kernel9ocl_queuei9ndrange_tjPK12ocl_clkeventP12ocl_clkeventU13block_pointerFvPU3AS3vzEjz(%opencl.queue_t* %call3, i32 241, %struct.ndrange_t* byval %agg.tmp, i32 0, %opencl.clk_event_t** null, %opencl.clk_event_t** null, %opencl.block* %6, i32 %7, i32 %mul)
- %10 = load %opencl.block** %block, align 8
+ %call4 = call spir_func i32 (%opencl.queue_t*, i32, %struct.ndrange_t*, i32, %opencl.clk_event_t**, %opencl.clk_event_t**, %opencl.block*, i32, ...) @_Z14enqueue_kernel9ocl_queuei9ndrange_tjPK12ocl_clkeventP12ocl_clkeventU13block_pointerFvPU3AS3vzEjz(%opencl.queue_t* %call3, i32 241, %struct.ndrange_t* byval %agg.tmp, i32 0, %opencl.clk_event_t** null, %opencl.clk_event_t** null, %opencl.block* %6, i32 %7, i32 %mul)
+ %10 = load %opencl.block*, %opencl.block** %block, align 8
%call5 = call spir_func i32 @_Z26get_kernel_work_group_sizeU13block_pointerFvvE(%opencl.block* %10)
store i32 %call5, i32* %wgSize, align 4
- %11 = load %opencl.block** %block, align 8
+ %11 = load %opencl.block*, %opencl.block** %block, align 8
%call6 = call spir_func i32 @_Z45get_kernel_preferred_work_group_size_multipleU13block_pointerFvvE(%opencl.block* %11)
store i32 %call6, i32* %prefMul, align 4
%call7 = call spir_func %opencl.queue_t* @_Z17get_default_queuev()
call spir_func void @_Z10ndrange_1Dm(%struct.ndrange_t* sret %agg.tmp8, i64 1)
- %12 = load %opencl.block** %block, align 8
+ %12 = load %opencl.block*, %opencl.block** %block, align 8
%call9 = call spir_func i32 @_Z14enqueue_kernel9ocl_queuei9ndrange_tjPK12ocl_clkeventP12ocl_clkeventU13block_pointerFvvE(%opencl.queue_t* %call7, i32 241, %struct.ndrange_t* byval %agg.tmp8, i32 0, %opencl.clk_event_t** null, %opencl.clk_event_t** null, %opencl.block* %12)
ret void
}
@@ -135,14 +135,14 @@ entry:
%ptr1.addr = alloca i8 addrspace(3)*, align 8
%block.addr = alloca <{}>*, align 8
store i8* %.block_descriptor, i8** %.block_descriptor.addr, align 8
- %0 = load i8** %.block_descriptor.addr
+ %0 = load i8*, i8** %.block_descriptor.addr
store i8 addrspace(3)* %ptr0, i8 addrspace(3)** %ptr0.addr, align 8
store i8 addrspace(3)* %ptr1, i8 addrspace(3)** %ptr1.addr, align 8
%block = bitcast i8* %.block_descriptor to <{}>*
store <{}>* %block, <{}>** %block.addr, align 8
- %1 = load i8 addrspace(3)** %ptr0.addr, align 8
+ %1 = load i8 addrspace(3)*, i8 addrspace(3)** %ptr0.addr, align 8
%2 = bitcast i8 addrspace(3)* %1 to float addrspace(3)*
- %3 = load i8 addrspace(3)** %ptr1.addr, align 8
+ %3 = load i8 addrspace(3)*, i8 addrspace(3)** %ptr1.addr, align 8
%4 = bitcast i8 addrspace(3)* %3 to float addrspace(3)*
call spir_func void @device_kernel_with_local_args(float addrspace(3)* %2, float addrspace(3)* %4)
ret void
@@ -156,11 +156,11 @@ entry:
%.block_descriptor.addr = alloca i8*, align 8
%block.addr = alloca <{ float addrspace(1)* }>*, align 8
store i8* %.block_descriptor, i8** %.block_descriptor.addr, align 8
- %0 = load i8** %.block_descriptor.addr
+ %0 = load i8*, i8** %.block_descriptor.addr
%block = bitcast i8* %.block_descriptor to <{ float addrspace(1)* }>*
store <{ float addrspace(1)* }>* %block, <{ float addrspace(1)* }>** %block.addr, align 8
- %block.capture.addr = getelementptr inbounds <{ float addrspace(1)* }>* %block, i32 0, i32 0
- %1 = load float addrspace(1)** %block.capture.addr, align 8
+ %block.capture.addr = getelementptr inbounds <{ float addrspace(1)* }>, <{ float addrspace(1)* }>* %block, i32 0, i32 0
+ %1 = load float addrspace(1)*, float addrspace(1)** %block.capture.addr, align 8
call spir_func void @device_kernel(float addrspace(1)* %1)
ret void
}
diff --git a/test/transcoding/device_execution_simple_local_memory.ll b/test/transcoding/device_execution_simple_local_memory.ll
index 4e94ac3..cc615e5 100644
--- a/test/transcoding/device_execution_simple_local_memory.ll
+++ b/test/transcoding/device_execution_simple_local_memory.ll
@@ -42,9 +42,9 @@ entry:
%ptr1.addr = alloca float addrspace(3)*, align 8
store float addrspace(3)* %ptr0, float addrspace(3)** %ptr0.addr, align 8
store float addrspace(3)* %ptr1, float addrspace(3)** %ptr1.addr, align 8
- %0 = load float addrspace(3)** %ptr0.addr, align 8
+ %0 = load float addrspace(3)*, float addrspace(3)** %ptr0.addr, align 8
store float 0.000000e+00, float addrspace(3)* %0, align 4
- %1 = load float addrspace(3)** %ptr1.addr, align 8
+ %1 = load float addrspace(3)*, float addrspace(3)** %ptr1.addr, align 8
store float 1.000000e+00, float addrspace(3)* %1, align 4
ret void
}
@@ -60,23 +60,23 @@ entry:
store i32 %size, i32* %size.addr, align 4
%0 = call %opencl.block* @spir_block_bind(i8* bitcast (void (i8*, i8 addrspace(3)*, i8 addrspace(3)*)* @__host_kernel_block_invoke to i8*), i32 0, i32 0, i8* null)
store %opencl.block* %0, %opencl.block** %block, align 8
- %1 = load %opencl.block** %block, align 8
+ %1 = load %opencl.block*, %opencl.block** %block, align 8
; CHECK: call {{.*}} @_Z26get_kernel_work_group_sizeU13block_pointerFvPU3AS3vzE
%call = call spir_func i32 @_Z26get_kernel_work_group_sizeU13block_pointerFvPU3AS3vzE(%opencl.block* %1)
store i32 %call, i32* %wgSize, align 4
- %2 = load %opencl.block** %block, align 8
+ %2 = load %opencl.block*, %opencl.block** %block, align 8
; CHECK: call {{.*}} @_Z45get_kernel_preferred_work_group_size_multipleU13block_pointerFvPU3AS3vzE
%call1 = call spir_func i32 @_Z45get_kernel_preferred_work_group_size_multipleU13block_pointerFvPU3AS3vzE(%opencl.block* %2)
store i32 %call1, i32* %prefMul, align 4
%call2 = call spir_func %opencl.queue_t* @_Z17get_default_queuev()
call spir_func void @_Z10ndrange_1Dm(%struct.ndrange_t* sret %agg.tmp, i64 1)
- %3 = load %opencl.block** %block, align 8
- %4 = load i32* %size.addr, align 4
- %5 = load i32* %wgSize, align 4
- %6 = load i32* %prefMul, align 4
+ %3 = load %opencl.block*, %opencl.block** %block, align 8
+ %4 = load i32, i32* %size.addr, align 4
+ %5 = load i32, i32* %wgSize, align 4
+ %6 = load i32, i32* %prefMul, align 4
%mul = mul i32 %5, %6
; CHECK: call {{.*}} @_Z14enqueue_kernel{{.*}}U13block_pointerFvPU3AS3vzEjz({{.*}}, %opencl.block* {{.*}}, i32 {{.*}}, i32 {{.*}})
- %call3 = call spir_func i32 (%opencl.queue_t*, i32, %struct.ndrange_t*, i32, %opencl.clk_event_t**, %opencl.clk_event_t**, %opencl.block*, i32, ...)* @_Z14enqueue_kernel9ocl_queuei9ndrange_tjPK12ocl_clkeventP12ocl_clkeventU13block_pointerFvPU3AS3vzEjz(%opencl.queue_t* %call2, i32 241, %struct.ndrange_t* byval %agg.tmp, i32 0, %opencl.clk_event_t** null, %opencl.clk_event_t** null, %opencl.block* %3, i32 %4, i32 %mul)
+ %call3 = call spir_func i32 (%opencl.queue_t*, i32, %struct.ndrange_t*, i32, %opencl.clk_event_t**, %opencl.clk_event_t**, %opencl.block*, i32, ...) @_Z14enqueue_kernel9ocl_queuei9ndrange_tjPK12ocl_clkeventP12ocl_clkeventU13block_pointerFvPU3AS3vzEjz(%opencl.queue_t* %call2, i32 241, %struct.ndrange_t* byval %agg.tmp, i32 0, %opencl.clk_event_t** null, %opencl.clk_event_t** null, %opencl.block* %3, i32 %4, i32 %mul)
ret void
}
@@ -89,14 +89,14 @@ entry:
%ptr1.addr = alloca i8 addrspace(3)*, align 8
%block.addr = alloca <{}>*, align 8
store i8* %.block_descriptor, i8** %.block_descriptor.addr, align 8
- %0 = load i8** %.block_descriptor.addr
+ %0 = load i8*, i8** %.block_descriptor.addr
store i8 addrspace(3)* %ptr0, i8 addrspace(3)** %ptr0.addr, align 8
store i8 addrspace(3)* %ptr1, i8 addrspace(3)** %ptr1.addr, align 8
%block = bitcast i8* %.block_descriptor to <{}>*
store <{}>* %block, <{}>** %block.addr, align 8
- %1 = load i8 addrspace(3)** %ptr0.addr, align 8
+ %1 = load i8 addrspace(3)*, i8 addrspace(3)** %ptr0.addr, align 8
%2 = bitcast i8 addrspace(3)* %1 to float addrspace(3)*
- %3 = load i8 addrspace(3)** %ptr1.addr, align 8
+ %3 = load i8 addrspace(3)*, i8 addrspace(3)** %ptr1.addr, align 8
%4 = bitcast i8 addrspace(3)* %3 to float addrspace(3)*
call spir_func void @device_kernel(float addrspace(3)* %2, float addrspace(3)* %4)
ret void
diff --git a/test/transcoding/fclamp.ll b/test/transcoding/fclamp.ll
index 0176cf9..67193eb 100644
--- a/test/transcoding/fclamp.ll
+++ b/test/transcoding/fclamp.ll
@@ -17,9 +17,9 @@ target triple = "spir-unknown-unknown"
; Function Attrs: nounwind
define spir_kernel void @test_scalar(float addrspace(1)* nocapture readonly %f) #0 {
entry:
- %0 = load float addrspace(1)* %f, align 4
+ %0 = load float, float addrspace(1)* %f, align 4
%call = tail call spir_func float @_Z5clampfff(float %0, float 0.000000e+00, float 1.000000e+00) #2
- %1 = load float addrspace(1)* %f, align 4
+ %1 = load float, float addrspace(1)* %f, align 4
%conv = fptrunc float %1 to half
%call1 = tail call spir_func half @_Z5clampDhDhDh(half %conv, half %conv, half %conv) #2
ret void
diff --git a/test/transcoding/image_with_access_qualifiers.ll b/test/transcoding/image_with_access_qualifiers.ll
index baa21b2..dcf4218 100644
--- a/test/transcoding/image_with_access_qualifiers.ll
+++ b/test/transcoding/image_with_access_qualifiers.ll
@@ -27,7 +27,7 @@ define spir_func void @sampFun(%opencl.image1d_rw_t addrspace(1)* %image) #0 {
entry:
%image.addr = alloca %opencl.image1d_rw_t addrspace(1)*, align 4
store %opencl.image1d_rw_t addrspace(1)* %image, %opencl.image1d_rw_t addrspace(1)** %image.addr, align 4
- %0 = load %opencl.image1d_rw_t addrspace(1)** %image.addr, align 4
+ %0 = load %opencl.image1d_rw_t addrspace(1)*, %opencl.image1d_rw_t addrspace(1)** %image.addr, align 4
%call = call spir_func <4 x float> @_Z11read_imagef14ocl_image1d_rw11ocl_sampleri(%opencl.image1d_rw_t addrspace(1)* %0, i32 8, i32 2) #2
ret void
}
diff --git a/test/transcoding/isequal.ll b/test/transcoding/isequal.ll
index 6070fd5..7038dd5 100644
--- a/test/transcoding/isequal.ll
+++ b/test/transcoding/isequal.ll
@@ -19,12 +19,12 @@ entry:
%call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
%sext = shl i64 %call, 32
%idxprom = ashr exact i64 %sext, 32
- %arrayidx = getelementptr inbounds <8 x float> addrspace(1)* %in1, i64 %idxprom
- %0 = load <8 x float> addrspace(1)* %arrayidx, align 32, !tbaa !9
- %arrayidx2 = getelementptr inbounds <8 x float> addrspace(1)* %in2, i64 %idxprom
- %1 = load <8 x float> addrspace(1)* %arrayidx2, align 32, !tbaa !9
+ %arrayidx = getelementptr inbounds <8 x float>, <8 x float> addrspace(1)* %in1, i64 %idxprom
+ %0 = load <8 x float>, <8 x float> addrspace(1)* %arrayidx, align 32, !tbaa !9
+ %arrayidx2 = getelementptr inbounds <8 x float>, <8 x float> addrspace(1)* %in2, i64 %idxprom
+ %1 = load <8 x float>, <8 x float> addrspace(1)* %arrayidx2, align 32, !tbaa !9
%call3 = tail call spir_func <8 x i32> @_Z7isequalDv8_fDv8_f(<8 x float> %0, <8 x float> %1) #2
- %arrayidx5 = getelementptr inbounds <8 x i32> addrspace(1)* %out, i64 %idxprom
+ %arrayidx5 = getelementptr inbounds <8 x i32>, <8 x i32> addrspace(1)* %out, i64 %idxprom
store <8 x i32> %call3, <8 x i32> addrspace(1)* %arrayidx5, align 32, !tbaa !9
ret void
}
diff --git a/test/transcoding/pipe_builtins.ll b/test/transcoding/pipe_builtins.ll
index c7c7a76..1718047 100644
--- a/test/transcoding/pipe_builtins.ll
+++ b/test/transcoding/pipe_builtins.ll
@@ -127,10 +127,10 @@ entry:
%call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
%sext = shl i64 %call, 32
%idxprom = ashr exact i64 %sext, 32
- %arrayidx = getelementptr inbounds i32 addrspace(1)* %src, i64 %idxprom
+ %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %src, i64 %idxprom
%0 = bitcast i32 addrspace(1)* %arrayidx to i8 addrspace(1)*
%1 = addrspacecast i8 addrspace(1)* %0 to i8 addrspace(4)*
- ; CHECK-LLVM: call{{.*}}@_Z10write_pipePU3AS18ocl_pipePU3AS4vjj
+ ; CHECK-LLVM: call{{.*}}@__write_pipe_2
; CHECK-SPIRV: WritePipe {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
%2 = tail call i32 @_Z10write_pipePU3AS18ocl_pipePU3AS4vjj(%opencl.pipe_t addrspace(1)* %out_pipe, i8 addrspace(4)* %1, i32 4, i32 4) #2
ret void
@@ -150,10 +150,10 @@ entry:
%call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
%sext = shl i64 %call, 32
%idxprom = ashr exact i64 %sext, 32
- %arrayidx = getelementptr inbounds i32 addrspace(1)* %dst, i64 %idxprom
+ %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %dst, i64 %idxprom
%0 = bitcast i32 addrspace(1)* %arrayidx to i8 addrspace(1)*
%1 = addrspacecast i8 addrspace(1)* %0 to i8 addrspace(4)*
- ; CHECK-LLVM: call{{.*}}@_Z9read_pipePU3AS18ocl_pipePU3AS4vjj
+ ; CHECK-LLVM: call{{.*}}@__read_pipe_2
; CHECK-SPIRV: ReadPipe {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
%2 = tail call i32 @_Z9read_pipePU3AS18ocl_pipePU3AS4vjj(%opencl.pipe_t addrspace(1)* %in_pipe, i8 addrspace(4)* %1, i32 4, i32 4) #2
ret void
@@ -170,7 +170,7 @@ define spir_kernel void @test_pipe_write(i32 addrspace(1)* %src, %opencl.pipe_t
; CHECK-SPIRV-NEXT: FunctionParameter {{[0-9]+}} [[PipeArgID:[0-9]+]]
entry:
%call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
- ; CHECK-LLVM: @_Z18reserve_write_pipePU3AS18ocl_pipejjj
+ ; CHECK-LLVM: @__reserve_write_pipe
; CHECK-SPIRV: ReserveWritePipePackets {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
%0 = tail call %opencl.reserve_id_t* @_Z18reserve_write_pipePU3AS18ocl_pipejjj(%opencl.pipe_t addrspace(1)* %out_pipe, i32 1, i32 4, i32 4) #2
%call1 = tail call spir_func zeroext i1 @_Z19is_valid_reserve_id13ocl_reserveid(%opencl.reserve_id_t* %0) #2
@@ -179,13 +179,13 @@ entry:
if.then: ; preds = %entry
%sext = shl i64 %call, 32
%idxprom = ashr exact i64 %sext, 32
- %arrayidx = getelementptr inbounds i32 addrspace(1)* %src, i64 %idxprom
+ %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %src, i64 %idxprom
%1 = bitcast i32 addrspace(1)* %arrayidx to i8 addrspace(1)*
%2 = addrspacecast i8 addrspace(1)* %1 to i8 addrspace(4)*
- ; CHECK-LLVM: call{{.*}}@_Z10write_pipePU3AS18ocl_pipe13ocl_reserveidjPU3AS4vjj
+ ; CHECK-LLVM: call{{.*}}@__write_pipe_4
; CHECK-SPIRV: ReservedWritePipe {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
%3 = tail call i32 @_Z10write_pipePU3AS18ocl_pipe13ocl_reserveidjPU3AS4vjj(%opencl.pipe_t addrspace(1)* %out_pipe, %opencl.reserve_id_t* %0, i32 0, i8 addrspace(4)* %2, i32 4, i32 4) #2
- ; CHECK-LLVM: call{{.*}}@_Z17commit_write_pipePU3AS18ocl_pipe13ocl_reserveidjj
+ ; CHECK-LLVM: call{{.*}}@__commit_write_pipe
; CHECK-SPIRV: CommitWritePipe [[PipeArgID]] {{[0-9]+}} {{[0-9]+}}
tail call void @_Z17commit_write_pipePU3AS18ocl_pipe13ocl_reserveidjj(%opencl.pipe_t addrspace(1)* %out_pipe, %opencl.reserve_id_t* %0, i32 4, i32 4) #2
br label %if.end
@@ -209,11 +209,11 @@ define spir_kernel void @test_pipe_query_functions(%opencl.pipe_t addrspace(1)*
; CHECK-SPIRV-LABEL: 5 Function
; CHECK-SPIRV-NEXT: FunctionParameter {{[0-9]+}} [[PipeArgID:[0-9]+]]
entry:
- ; CHECK-LLVM: call{{.*}}@_Z20get_pipe_max_packetsPU3AS18ocl_pipejj
+ ; CHECK-LLVM: call{{.*}}@__get_pipe_max_packets
; CHECK-SPIRV: GetMaxPipePackets {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}}
%0 = tail call i32 @_Z20get_pipe_max_packetsPU3AS18ocl_pipejj(%opencl.pipe_t addrspace(1)* %out_pipe, i32 4, i32 4) #2
store i32 %0, i32 addrspace(1)* %max_packets, align 4, !tbaa !35
- ; CHECK-LLVM: call{{.*}}@_Z20get_pipe_num_packetsPU3AS18ocl_pipejj
+ ; CHECK-LLVM: call{{.*}}@__get_pipe_num_packets
; CHECK-SPIRV: GetNumPipePackets {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}}
%1 = tail call i32 @_Z20get_pipe_num_packetsPU3AS18ocl_pipejj(%opencl.pipe_t addrspace(1)* %out_pipe, i32 4, i32 4) #2
store i32 %1, i32 addrspace(1)* %num_packets, align 4, !tbaa !35
@@ -232,7 +232,7 @@ define spir_kernel void @test_pipe_read(%opencl.pipe_t addrspace(1)* %in_pipe, i
; CHECK-SPIRV-NEXT: FunctionParameter {{[0-9]+}} [[PipeArgID:[0-9]+]]
entry:
%call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
- ; CHECK-LLVM: call{{.*}}@_Z17reserve_read_pipePU3AS18ocl_pipejjj
+ ; CHECK-LLVM: call{{.*}}@__reserve_read_pipe
; CHECK-SPIRV: ReserveReadPipePackets {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
%0 = tail call %opencl.reserve_id_t* @_Z17reserve_read_pipePU3AS18ocl_pipejjj(%opencl.pipe_t addrspace(1)* %in_pipe, i32 1, i32 4, i32 4) #2
%call1 = tail call spir_func zeroext i1 @_Z19is_valid_reserve_id13ocl_reserveid(%opencl.reserve_id_t* %0) #2
@@ -241,13 +241,13 @@ entry:
if.then: ; preds = %entry
%sext = shl i64 %call, 32
%idxprom = ashr exact i64 %sext, 32
- %arrayidx = getelementptr inbounds i32 addrspace(1)* %dst, i64 %idxprom
+ %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %dst, i64 %idxprom
%1 = bitcast i32 addrspace(1)* %arrayidx to i8 addrspace(1)*
%2 = addrspacecast i8 addrspace(1)* %1 to i8 addrspace(4)*
- ; CHECK-LLVM: call{{.*}}@_Z9read_pipePU3AS18ocl_pipe13ocl_reserveidjPU3AS4vjj
+ ; CHECK-LLVM: call{{.*}}@__read_pipe_4
; CHECK-SPIRV: ReservedReadPipe {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
%3 = tail call i32 @_Z9read_pipePU3AS18ocl_pipe13ocl_reserveidjPU3AS4vjj(%opencl.pipe_t addrspace(1)* %in_pipe, %opencl.reserve_id_t* %0, i32 0, i8 addrspace(4)* %2, i32 4, i32 4) #2
- ; CHECK-LLVM: call{{.*}}@_Z16commit_read_pipePU3AS18ocl_pipe13ocl_reserveidjj
+ ; CHECK-LLVM: call{{.*}}@__commit_read_pipe
; CHECK-SPIRV: CommitReadPipe [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
tail call void @_Z16commit_read_pipePU3AS18ocl_pipe13ocl_reserveidjj(%opencl.pipe_t addrspace(1)* %in_pipe, %opencl.reserve_id_t* %0, i32 4, i32 4) #2
br label %if.end
@@ -273,7 +273,7 @@ entry:
%call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
%call1 = tail call spir_func i64 @_Z14get_local_sizej(i32 0) #2
%0 = trunc i64 %call1 to i32
- ; CHECK-LLVM: call{{.*}}@_Z29work_group_reserve_write_pipePU3AS18ocl_pipejjj
+ ; CHECK-LLVM: call{{.*}}@__work_group_reserve_write_pipe
; CHECK-SPIRV: GroupReserveWritePipePackets {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
%1 = tail call %opencl.reserve_id_t* @_Z29work_group_reserve_write_pipePU3AS18ocl_pipejjj(%opencl.pipe_t addrspace(1)* %out_pipe, i32 %0, i32 1, i32 1) #2
store %opencl.reserve_id_t* %1, %opencl.reserve_id_t* addrspace(3)* @test_pipe_workgroup_write_char.res_id, align 8, !tbaa !39
@@ -281,16 +281,16 @@ entry:
br i1 %call2, label %if.then, label %if.end
if.then: ; preds = %entry
- %2 = load %opencl.reserve_id_t* addrspace(3)* @test_pipe_workgroup_write_char.res_id, align 8, !tbaa !39
+ %2 = load %opencl.reserve_id_t*, %opencl.reserve_id_t* addrspace(3)* @test_pipe_workgroup_write_char.res_id, align 8, !tbaa !39
%call3 = tail call spir_func i64 @_Z12get_local_idj(i32 0) #2
%sext = shl i64 %call, 32
%idxprom = ashr exact i64 %sext, 32
- %arrayidx = getelementptr inbounds i8 addrspace(1)* %src, i64 %idxprom
+ %arrayidx = getelementptr inbounds i8, i8 addrspace(1)* %src, i64 %idxprom
%3 = addrspacecast i8 addrspace(1)* %arrayidx to i8 addrspace(4)*
%4 = trunc i64 %call3 to i32
%5 = tail call i32 @_Z10write_pipePU3AS18ocl_pipe13ocl_reserveidjPU3AS4vjj(%opencl.pipe_t addrspace(1)* %out_pipe, %opencl.reserve_id_t* %2, i32 %4, i8 addrspace(4)* %3, i32 1, i32 1) #2
- %6 = load %opencl.reserve_id_t* addrspace(3)* @test_pipe_workgroup_write_char.res_id, align 8, !tbaa !39
- ; CHECK-LLVM: call{{.*}}@_Z28work_group_commit_write_pipePU3AS18ocl_pipe13ocl_reserveidjj
+ %6 = load %opencl.reserve_id_t*, %opencl.reserve_id_t* addrspace(3)* @test_pipe_workgroup_write_char.res_id, align 8, !tbaa !39
+ ; CHECK-LLVM: call{{.*}}@__work_group_commit_write_pipe
; CHECK-SPIRV: GroupCommitWritePipe {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
tail call void @_Z28work_group_commit_write_pipePU3AS18ocl_pipe13ocl_reserveidjj(%opencl.pipe_t addrspace(1)* %out_pipe, %opencl.reserve_id_t* %6, i32 1, i32 1) #2
br label %if.end
@@ -317,7 +317,7 @@ entry:
%call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
%call1 = tail call spir_func i64 @_Z14get_local_sizej(i32 0) #2
%0 = trunc i64 %call1 to i32
- ; CHECK-LLVM: call{{.*}}@_Z28work_group_reserve_read_pipePU3AS18ocl_pipejjj
+ ; CHECK-LLVM: call{{.*}}@__work_group_reserve_read_pipe
; CHECK-SPIRV: GroupReserveReadPipePackets {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
%1 = tail call %opencl.reserve_id_t* @_Z28work_group_reserve_read_pipePU3AS18ocl_pipejjj(%opencl.pipe_t addrspace(1)* %in_pipe, i32 %0, i32 1, i32 1) #2
store %opencl.reserve_id_t* %1, %opencl.reserve_id_t* addrspace(3)* @test_pipe_workgroup_read_char.res_id, align 8, !tbaa !39
@@ -325,16 +325,16 @@ entry:
br i1 %call2, label %if.then, label %if.end
if.then: ; preds = %entry
- %2 = load %opencl.reserve_id_t* addrspace(3)* @test_pipe_workgroup_read_char.res_id, align 8, !tbaa !39
+ %2 = load %opencl.reserve_id_t*, %opencl.reserve_id_t* addrspace(3)* @test_pipe_workgroup_read_char.res_id, align 8, !tbaa !39
%call3 = tail call spir_func i64 @_Z12get_local_idj(i32 0) #2
%sext = shl i64 %call, 32
%idxprom = ashr exact i64 %sext, 32
- %arrayidx = getelementptr inbounds i8 addrspace(1)* %dst, i64 %idxprom
+ %arrayidx = getelementptr inbounds i8, i8 addrspace(1)* %dst, i64 %idxprom
%3 = addrspacecast i8 addrspace(1)* %arrayidx to i8 addrspace(4)*
%4 = trunc i64 %call3 to i32
%5 = tail call i32 @_Z9read_pipePU3AS18ocl_pipe13ocl_reserveidjPU3AS4vjj(%opencl.pipe_t addrspace(1)* %in_pipe, %opencl.reserve_id_t* %2, i32 %4, i8 addrspace(4)* %3, i32 1, i32 1) #2
- %6 = load %opencl.reserve_id_t* addrspace(3)* @test_pipe_workgroup_read_char.res_id, align 8, !tbaa !39
- ; CHECK-LLVM: call{{.*}}@_Z27work_group_commit_read_pipePU3AS18ocl_pipe13ocl_reserveidjj
+ %6 = load %opencl.reserve_id_t*, %opencl.reserve_id_t* addrspace(3)* @test_pipe_workgroup_read_char.res_id, align 8, !tbaa !39
+ ; CHECK-LLVM: call{{.*}}@__work_group_commit_read_pipe
; CHECK-SPIRV: GroupCommitReadPipe {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
tail call void @_Z27work_group_commit_read_pipePU3AS18ocl_pipe13ocl_reserveidjj(%opencl.pipe_t addrspace(1)* %in_pipe, %opencl.reserve_id_t* %6, i32 1, i32 1) #2
br label %if.end
@@ -357,7 +357,7 @@ define spir_kernel void @test_pipe_subgroup_write_uint(i32 addrspace(1)* %src, %
entry:
%call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
%call1 = tail call spir_func i32 @_Z18get_sub_group_sizev() #2
- ; CHECK-LLVM: call{{.*}}@_Z28sub_group_reserve_write_pipePU3AS18ocl_pipejjj
+ ; CHECK-LLVM: call{{.*}}@__sub_group_reserve_write_pipe
; CHECK-SPIRV: GroupReserveWritePipePackets {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
%0 = tail call %opencl.reserve_id_t* @_Z28sub_group_reserve_write_pipePU3AS18ocl_pipejjj(%opencl.pipe_t addrspace(1)* %out_pipe, i32 %call1, i32 4, i32 4) #2
%call2 = tail call spir_func zeroext i1 @_Z19is_valid_reserve_id13ocl_reserveid(%opencl.reserve_id_t* %0) #2
@@ -367,11 +367,11 @@ if.then: ; preds = %entry
%call3 = tail call spir_func i32 @_Z22get_sub_group_local_idv() #2
%sext = shl i64 %call, 32
%idxprom = ashr exact i64 %sext, 32
- %arrayidx = getelementptr inbounds i32 addrspace(1)* %src, i64 %idxprom
+ %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %src, i64 %idxprom
%1 = bitcast i32 addrspace(1)* %arrayidx to i8 addrspace(1)*
%2 = addrspacecast i8 addrspace(1)* %1 to i8 addrspace(4)*
%3 = tail call i32 @_Z10write_pipePU3AS18ocl_pipe13ocl_reserveidjPU3AS4vjj(%opencl.pipe_t addrspace(1)* %out_pipe, %opencl.reserve_id_t* %0, i32 %call3, i8 addrspace(4)* %2, i32 4, i32 4) #2
- ; CHECK-LLVM: call{{.*}}@_Z27sub_group_commit_write_pipePU3AS18ocl_pipe13ocl_reserveidjj
+ ; CHECK-LLVM: call{{.*}}@__sub_group_commit_write_pipe
; CHECK-SPIRV: GroupCommitWritePipe {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
tail call void @_Z27sub_group_commit_write_pipePU3AS18ocl_pipe13ocl_reserveidjj(%opencl.pipe_t addrspace(1)* %out_pipe, %opencl.reserve_id_t* %0, i32 4, i32 4) #2
br label %if.end
@@ -399,7 +399,7 @@ define spir_kernel void @test_pipe_subgroup_read_uint(%opencl.pipe_t addrspace(1
entry:
%call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
%call1 = tail call spir_func i32 @_Z18get_sub_group_sizev() #2
- ; CHECK-LLVM: call{{.*}}@_Z27sub_group_reserve_read_pipePU3AS18ocl_pipejjj
+ ; CHECK-LLVM: call{{.*}}@__sub_group_reserve_read_pipe
; CHECK-SPIRV: GroupReserveReadPipePackets {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
%0 = tail call %opencl.reserve_id_t* @_Z27sub_group_reserve_read_pipePU3AS18ocl_pipejjj(%opencl.pipe_t addrspace(1)* %in_pipe, i32 %call1, i32 4, i32 4) #2
%call2 = tail call spir_func zeroext i1 @_Z19is_valid_reserve_id13ocl_reserveid(%opencl.reserve_id_t* %0) #2
@@ -409,11 +409,11 @@ if.then: ; preds = %entry
%call3 = tail call spir_func i32 @_Z22get_sub_group_local_idv() #2
%sext = shl i64 %call, 32
%idxprom = ashr exact i64 %sext, 32
- %arrayidx = getelementptr inbounds i32 addrspace(1)* %dst, i64 %idxprom
+ %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %dst, i64 %idxprom
%1 = bitcast i32 addrspace(1)* %arrayidx to i8 addrspace(1)*
%2 = addrspacecast i8 addrspace(1)* %1 to i8 addrspace(4)*
%3 = tail call i32 @_Z9read_pipePU3AS18ocl_pipe13ocl_reserveidjPU3AS4vjj(%opencl.pipe_t addrspace(1)* %in_pipe, %opencl.reserve_id_t* %0, i32 %call3, i8 addrspace(4)* %2, i32 4, i32 4) #2
- ; CHECK-LLVM: call{{.*}}@_Z26sub_group_commit_read_pipePU3AS18ocl_pipe13ocl_reserveidjj
+ ; CHECK-LLVM: call{{.*}}@__sub_group_commit_read_pipe
; CHECK-SPIRV: GroupCommitReadPipe {{[0-9]+}} [[PipeArgID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
tail call void @_Z26sub_group_commit_read_pipePU3AS18ocl_pipe13ocl_reserveidjj(%opencl.pipe_t addrspace(1)* %in_pipe, %opencl.reserve_id_t* %0, i32 4, i32 4) #2
br label %if.end
diff --git a/tools/llvm-spirv/llvm-spirv.cpp b/tools/llvm-spirv/llvm-spirv.cpp
index bbc7f97..34c5caf 100644
--- a/tools/llvm-spirv/llvm-spirv.cpp
+++ b/tools/llvm-spirv/llvm-spirv.cpp
@@ -119,14 +119,14 @@ convertLLVMToSPIRV() {
LLVMContext Context;
std::string Err;
- DataStreamer *DS = getDataFileStreamer(InputFile, &Err);
+ std::unique_ptr<DataStreamer> DS = getDataFileStreamer(InputFile, &Err);
if (!DS) {
errs() << "Fails to open input file: " << Err;
return -1;
}
ErrorOr<std::unique_ptr<Module>> MOrErr =
- getStreamedBitcodeModule(InputFile, DS, Context);
+ getStreamedBitcodeModule(InputFile, std::move(DS), Context);
if (std::error_code EC = MOrErr.getError()) {
errs() << "Fails to load bitcode: " << EC.message();
@@ -135,7 +135,7 @@ convertLLVMToSPIRV() {
std::unique_ptr<Module> M = std::move(*MOrErr);
- if (std::error_code EC = M->materializeAllPermanently()){
+ if (std::error_code EC = M->materializeAll()){
errs() << "Fails to materialize: " << EC.message();
return -1;
}
@@ -239,14 +239,14 @@ regularizeLLVM() {
LLVMContext Context;
std::string Err;
- DataStreamer *DS = getDataFileStreamer(InputFile, &Err);
+ std::unique_ptr<DataStreamer> DS = getDataFileStreamer(InputFile, &Err);
if (!DS) {
errs() << "Fails to open input file: " << Err;
return -1;
}
ErrorOr<std::unique_ptr<Module>> MOrErr =
- getStreamedBitcodeModule(InputFile, DS, Context);
+ getStreamedBitcodeModule(InputFile, std::move(DS), Context);
if (std::error_code EC = MOrErr.getError()) {
errs() << "Fails to load bitcode: " << EC.message();
@@ -255,7 +255,7 @@ regularizeLLVM() {
std::unique_ptr<Module> M = std::move(*MOrErr);
- if (std::error_code EC = M->materializeAllPermanently()){
+ if (std::error_code EC = M->materializeAll()){
errs() << "Fails to materialize: " << EC.message();
return -1;
}