Skip to content

Commit 840942c

Browse files
iclsrcvladimirlaz
authored andcommitted
Merge from 'sycl' to 'sycl-web' (#1)
CONFLICT (content): Merge conflict in clang/lib/Sema/SemaDeclAttr.cpp
2 parents 80ed4b5 + 8031a14 commit 840942c

File tree

63 files changed

+1115
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1115
-177
lines changed

buildbot/dependency.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ def do_dependency(args):
5858
# fetch and build OpenCL ICD loader
5959
icd_loader_dir = os.path.join(args.obj_dir, "OpenCL-ICD-Loader")
6060
if not os.path.isdir(icd_loader_dir):
61-
clone_cmd = ["git", "clone", "https://github.com/KhronosGroup/OpenCL-ICD-Loader", "OpenCL-ICD-Loader"]
61+
clone_cmd = ["git", "clone",
62+
"https://github.com/KhronosGroup/OpenCL-ICD-Loader",
63+
"OpenCL-ICD-Loader", "-b", "v2020.06.16"]
64+
6265
subprocess.check_call(clone_cmd, cwd=args.obj_dir)
6366
else:
6467
fetch_cmd = ["git", "pull", "--ff", "--ff-only", "origin"]

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8527,7 +8527,7 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
85278527
break;
85288528
case ParsedAttr::AT_SYCLIntelPipeIO:
85298529
handleSYCLIntelPipeIOAttr(S, D, AL);
8530-
break;
8530+
break;
85318531

85328532
// Swift attributes.
85338533
case ParsedAttr::AT_SwiftBridge:

llvm-spirv/.travis.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ before_install:
2323
- |
2424
if [ $TRAVIS_OS_NAME == "linux" ]; then
2525
curl -L "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add -
26-
curl -L "http://packages.lunarg.com/lunarg-signing-key-pub.asc" | sudo apt-key add -
26+
curl -L "https://packages.lunarg.com/lunarg-signing-key-pub.asc" | sudo apt-key add -
2727
curl -L "https://apt.kitware.com/keys/kitware-archive-latest.asc" | sudo apt-key add -
28-
echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" | sudo tee -a ${TRAVIS_ROOT}/etc/apt/sources.list
28+
echo "deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic main" | sudo tee -a ${TRAVIS_ROOT}/etc/apt/sources.list
2929
echo "deb https://packages.lunarg.com/vulkan bionic main" | sudo tee -a ${TRAVIS_ROOT}/etc/apt/sources.list
3030
echo "deb https://apt.kitware.com/ubuntu/ bionic main" | sudo tee -a ${TRAVIS_ROOT}/etc/apt/sources.list
3131
sudo apt-get update
@@ -40,7 +40,6 @@ before_install:
4040
4141
compiler:
4242
- gcc
43-
- clang
4443

4544
env:
4645
global:
@@ -57,7 +56,6 @@ env:
5756
- BUILD_TYPE=Debug BUILD_EXTERNAL=1 SHARED_LIBS=OFF MAKE_TARGETS="" MAKE_TEST_TARGET="test"
5857
- BUILD_TYPE=Release BUILD_EXTERNAL=0 SHARED_LIBS=OFF MAKE_TARGETS="llvm-spirv" MAKE_TEST_TARGET="check-llvm-spirv"
5958
- BUILD_TYPE=Debug BUILD_EXTERNAL=0 SHARED_LIBS=OFF MAKE_TARGETS="llvm-spirv" MAKE_TEST_TARGET="check-llvm-spirv"
60-
# some bug inside clang-5.0.0, works with 5.0.1
6159

6260
matrix:
6361
include:
@@ -69,6 +67,15 @@ matrix:
6967
env: BUILD_TYPE=Debug BUILD_EXTERNAL=0 MAKE_TARGETS="llvm-spirv" MAKE_TEST_TARGET="check-llvm-spirv"
7068
osx_image: xcode12
7169

70+
- compiler: clang
71+
env: BUILD_TYPE=Release BUILD_EXTERNAL=1 SHARED_LIBS=OFF MAKE_TARGETS="" MAKE_TEST_TARGET="test"
72+
73+
- compiler: clang
74+
env: BUILD_TYPE=Debug BUILD_EXTERNAL=1 SHARED_LIBS=ON MAKE_TARGETS="" MAKE_TEST_TARGET="test"
75+
76+
- compiler: clang
77+
env: BUILD_TYPE=Release BUILD_EXTERNAL=0 SHARED_LIBS=ON MAKE_TARGETS="llvm-spirv" MAKE_TEST_TARGET="check-llvm-spirv"
78+
7279
- env: BUILD_EXTERNAL=1 CHECK_FORMAT=1
7380

7481
- env: BUILD_EXTERNAL=1 CHECK_TIDY=1

llvm-spirv/include/LLVMSPIRVOpts.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ class TranslatorOpts {
148148
SPIRVAllowUnknownIntrinsics = AllowUnknownIntrinsics;
149149
}
150150

151+
bool allowExtraDIExpressions() const noexcept {
152+
return AllowExtraDIExpressions;
153+
}
154+
155+
void setAllowExtraDIExpressionsEnabled(bool Allow) noexcept {
156+
AllowExtraDIExpressions = Allow;
157+
}
158+
151159
DebugInfoEIS getDebugInfoEIS() const { return DebugInfoVersion; }
152160

153161
void setDebugInfoEIS(DebugInfoEIS EIS) { DebugInfoVersion = EIS; }
@@ -179,6 +187,10 @@ class TranslatorOpts {
179187
// SPIR-V
180188
bool SPIRVAllowUnknownIntrinsics = false;
181189

190+
// Enable support for extra DIExpression opcodes not listed in the SPIR-V
191+
// DebugInfo specification.
192+
bool AllowExtraDIExpressions = false;
193+
182194
DebugInfoEIS DebugInfoVersion = DebugInfoEIS::OpenCL_DebugInfo_100;
183195
};
184196

llvm-spirv/lib/SPIRV/LLVMToSPIRVDbgTran.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,10 +959,14 @@ SPIRVEntry *LLVMToSPIRVDbgTran::transDbgExpression(const DIExpression *Expr) {
959959
for (unsigned I = 0, N = Expr->getNumElements(); I < N; ++I) {
960960
using namespace SPIRVDebug::Operand::Operation;
961961
auto DWARFOpCode = static_cast<dwarf::LocationAtom>(Expr->getElement(I));
962+
962963
SPIRVDebug::ExpressionOpCode OC =
963964
SPIRV::DbgExpressionOpCodeMap::map(DWARFOpCode);
964-
assert(OpCountMap.find(OC) != OpCountMap.end() &&
965-
"unhandled opcode found in DIExpression");
965+
if (OpCountMap.find(OC) == OpCountMap.end())
966+
report_fatal_error("unknown opcode found in DIExpression");
967+
if (OC > SPIRVDebug::Fragment && !BM->allowExtraDIExpressions())
968+
report_fatal_error("unsupported opcode found in DIExpression");
969+
966970
unsigned OpCount = OpCountMap[OC];
967971
SPIRVWordVec Op(OpCount);
968972
Op[OpCodeIdx] = OC;

llvm-spirv/lib/SPIRV/OCL20ToSPIRV.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@
4040
#include "OCLTypeToSPIRV.h"
4141
#include "OCLUtil.h"
4242
#include "SPIRVInternal.h"
43+
#include "libSPIRV/SPIRVDebug.h"
4344

4445
#include "llvm/ADT/StringSwitch.h"
4546
#include "llvm/Analysis/ValueTracking.h"
4647
#include "llvm/IR/IRBuilder.h"
4748
#include "llvm/IR/InstVisitor.h"
4849
#include "llvm/IR/Instruction.h"
4950
#include "llvm/IR/Instructions.h"
50-
#include "llvm/IR/Verifier.h"
5151
#include "llvm/Pass.h"
52-
#include "llvm/Support/Debug.h"
5352

5453
#include <algorithm>
5554
#include <set>
@@ -349,11 +348,8 @@ bool OCL20ToSPIRV::runOnModule(Module &Module) {
349348
eraseUselessFunctions(M); // remove unused functions declarations
350349
LLVM_DEBUG(dbgs() << "After OCL20ToSPIRV:\n" << *M);
351350

352-
std::string Err;
353-
raw_string_ostream ErrorOS(Err);
354-
if (verifyModule(*M, &ErrorOS)) {
355-
LLVM_DEBUG(errs() << "Fails to verify module: " << ErrorOS.str());
356-
}
351+
verifyRegularizationPass(*M, "OCL20ToSPIRV");
352+
357353
return true;
358354
}
359355

@@ -1261,11 +1257,16 @@ void OCL20ToSPIRV::transWorkItemBuiltinsToVariables() {
12611257
for (auto UI = I.user_begin(), UE = I.user_end(); UI != UE; ++UI) {
12621258
auto CI = dyn_cast<CallInst>(*UI);
12631259
assert(CI && "invalid instruction");
1264-
Value *NewValue = new LoadInst(GVType, BV, "", CI);
1260+
const DebugLoc &DLoc = CI->getDebugLoc();
1261+
Instruction *NewValue = new LoadInst(GVType, BV, "", CI);
1262+
if (DLoc)
1263+
NewValue->setDebugLoc(DLoc);
12651264
LLVM_DEBUG(dbgs() << "Transform: " << *CI << " => " << *NewValue << '\n');
12661265
if (IsVec) {
12671266
NewValue =
12681267
ExtractElementInst::Create(NewValue, CI->getArgOperand(0), "", CI);
1268+
if (DLoc)
1269+
NewValue->setDebugLoc(DLoc);
12691270
LLVM_DEBUG(dbgs() << *NewValue << '\n');
12701271
}
12711272
NewValue->takeName(CI);

llvm-spirv/lib/SPIRV/OCL21ToSPIRV.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939

4040
#include "OCLUtil.h"
4141
#include "SPIRVInternal.h"
42+
#include "libSPIRV/SPIRVDebug.h"
43+
4244
#include "llvm/ADT/StringSwitch.h"
4345
#include "llvm/IR/IRBuilder.h"
4446
#include "llvm/IR/InstVisitor.h"
4547
#include "llvm/IR/Instructions.h"
46-
#include "llvm/IR/Verifier.h"
4748
#include "llvm/Pass.h"
48-
#include "llvm/Support/Debug.h"
4949

5050
#include <set>
5151

@@ -54,7 +54,6 @@ using namespace SPIRV;
5454
using namespace OCLUtil;
5555

5656
namespace SPIRV {
57-
5857
class OCL21ToSPIRV : public ModulePass, public InstVisitor<OCL21ToSPIRV> {
5958
public:
6059
OCL21ToSPIRV() : ModulePass(ID), M(nullptr), Ctx(nullptr), CLVer(0) {
@@ -122,11 +121,8 @@ bool OCL21ToSPIRV::runOnModule(Module &Module) {
122121
GV->eraseFromParent();
123122

124123
LLVM_DEBUG(dbgs() << "After OCL21ToSPIRV:\n" << *M);
125-
std::string Err;
126-
raw_string_ostream ErrorOS(Err);
127-
if (verifyModule(*M, &ErrorOS)) {
128-
LLVM_DEBUG(errs() << "Fails to verify module: " << ErrorOS.str());
129-
}
124+
verifyRegularizationPass(*M, "OCL21ToSPIRV");
125+
130126
return true;
131127
}
132128

llvm-spirv/lib/SPIRV/OCLUtil.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#include "llvm/IR/IRBuilder.h"
4747
#include "llvm/IR/InstVisitor.h"
4848
#include "llvm/IR/Instructions.h"
49-
#include "llvm/IR/Verifier.h"
5049
#include "llvm/Pass.h"
5150
#include "llvm/Support/CommandLine.h"
5251
#include "llvm/Support/Debug.h"

llvm-spirv/lib/SPIRV/PreprocessMetadata.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,12 @@
4343
#include "SPIRVMDBuilder.h"
4444
#include "SPIRVMDWalker.h"
4545
#include "VectorComputeUtil.h"
46+
#include "libSPIRV/SPIRVDebug.h"
4647

4748
#include "llvm/ADT/Triple.h"
4849
#include "llvm/IR/IRBuilder.h"
4950
#include "llvm/IR/InstVisitor.h"
50-
#include "llvm/IR/Verifier.h"
5151
#include "llvm/Pass.h"
52-
#include "llvm/Support/CommandLine.h"
53-
#include "llvm/Support/Debug.h"
5452

5553
using namespace llvm;
5654
using namespace SPIRV;
@@ -88,13 +86,10 @@ bool PreprocessMetadata::runOnModule(Module &Module) {
8886

8987
LLVM_DEBUG(dbgs() << "Enter PreprocessMetadata:\n");
9088
visit(M);
91-
9289
LLVM_DEBUG(dbgs() << "After PreprocessMetadata:\n" << *M);
93-
std::string Err;
94-
raw_string_ostream ErrorOS(Err);
95-
if (verifyModule(*M, &ErrorOS)) {
96-
LLVM_DEBUG(errs() << "Fails to verify module: " << ErrorOS.str());
97-
}
90+
91+
verifyRegularizationPass(*M, "PreprocessMetadata");
92+
9893
return true;
9994
}
10095

llvm-spirv/lib/SPIRV/SPIRVLowerBool.cpp

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,17 @@
3838
#define DEBUG_TYPE "spvbool"
3939

4040
#include "SPIRVInternal.h"
41+
#include "libSPIRV/SPIRVDebug.h"
42+
4143
#include "llvm/IR/IRBuilder.h"
4244
#include "llvm/IR/InstVisitor.h"
4345
#include "llvm/IR/Instructions.h"
44-
#include "llvm/IR/Verifier.h"
4546
#include "llvm/Pass.h"
46-
#include "llvm/Support/CommandLine.h"
47-
#include "llvm/Support/Debug.h"
4847

4948
using namespace llvm;
5049
using namespace SPIRV;
5150

5251
namespace SPIRV {
53-
cl::opt<bool> SPIRVLowerBoolValidate(
54-
"spvbool-validate",
55-
cl::desc("Validate module after lowering boolean instructions for SPIR-V"));
56-
5752
class SPIRVLowerBool : public ModulePass, public InstVisitor<SPIRVLowerBool> {
5853
public:
5954
SPIRVLowerBool() : ModulePass(ID), Context(nullptr) {
@@ -119,15 +114,7 @@ class SPIRVLowerBool : public ModulePass, public InstVisitor<SPIRVLowerBool> {
119114
Context = &M.getContext();
120115
visit(M);
121116

122-
if (SPIRVLowerBoolValidate) {
123-
LLVM_DEBUG(dbgs() << "After SPIRVLowerBool:\n" << M);
124-
std::string Err;
125-
raw_string_ostream ErrorOS(Err);
126-
if (verifyModule(M, &ErrorOS)) {
127-
Err = std::string("Fails to verify module: ") + Err;
128-
report_fatal_error(Err.c_str(), false);
129-
}
130-
}
117+
verifyRegularizationPass(M, "SPIRVLowerBool");
131118
return true;
132119
}
133120

llvm-spirv/lib/SPIRV/SPIRVLowerConstExpr.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,14 @@
4141
#include "SPIRVInternal.h"
4242
#include "SPIRVMDBuilder.h"
4343
#include "SPIRVMDWalker.h"
44+
#include "libSPIRV/SPIRVDebug.h"
4445

4546
#include "llvm/ADT/StringSwitch.h"
4647
#include "llvm/ADT/Triple.h"
4748
#include "llvm/IR/IRBuilder.h"
4849
#include "llvm/IR/InstVisitor.h"
4950
#include "llvm/IR/Instructions.h"
50-
#include "llvm/IR/Verifier.h"
5151
#include "llvm/Pass.h"
52-
#include "llvm/Support/CommandLine.h"
53-
#include "llvm/Support/Debug.h"
5452

5553
#include <list>
5654
#include <set>
@@ -93,12 +91,8 @@ bool SPIRVLowerConstExpr::runOnModule(Module &Module) {
9391
LLVM_DEBUG(dbgs() << "Enter SPIRVLowerConstExpr:\n");
9492
visit(M);
9593

96-
LLVM_DEBUG(dbgs() << "After SPIRVLowerConstExpr:\n" << *M);
97-
std::string Err;
98-
raw_string_ostream ErrorOS(Err);
99-
if (verifyModule(*M, &ErrorOS)) {
100-
LLVM_DEBUG(errs() << "Fails to verify module: " << ErrorOS.str());
101-
}
94+
verifyRegularizationPass(*M, "SPIRVLowerConstExpr");
95+
10296
return true;
10397
}
10498

llvm-spirv/lib/SPIRV/SPIRVLowerMemmove.cpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,18 @@
3838
#define DEBUG_TYPE "spvmemmove"
3939

4040
#include "SPIRVInternal.h"
41+
#include "libSPIRV/SPIRVDebug.h"
42+
4143
#include "llvm/IR/IRBuilder.h"
4244
#include "llvm/IR/InstVisitor.h"
4345
#include "llvm/IR/IntrinsicInst.h"
4446
#include "llvm/IR/Module.h"
45-
#include "llvm/IR/Verifier.h"
4647
#include "llvm/Pass.h"
47-
#include "llvm/Support/CommandLine.h"
48-
#include "llvm/Support/Debug.h"
4948

5049
using namespace llvm;
5150
using namespace SPIRV;
5251

5352
namespace SPIRV {
54-
cl::opt<bool> SPIRVLowerMemmoveValidate(
55-
"spvmemmove-validate",
56-
cl::desc("Validate module after lowering llvm.memmove instructions into "
57-
"llvm.memcpy"));
58-
5953
class SPIRVLowerMemmove : public ModulePass,
6054
public InstVisitor<SPIRVLowerMemmove> {
6155
public:
@@ -119,15 +113,7 @@ class SPIRVLowerMemmove : public ModulePass,
119113
Mod = &M;
120114
visit(M);
121115

122-
if (SPIRVLowerMemmoveValidate) {
123-
LLVM_DEBUG(dbgs() << "After SPIRVLowerMemmove:\n" << M);
124-
std::string Err;
125-
raw_string_ostream ErrorOS(Err);
126-
if (verifyModule(M, &ErrorOS)) {
127-
Err = std::string("Fails to verify module: ") + Err;
128-
report_fatal_error(Err.c_str(), false);
129-
}
130-
}
116+
verifyRegularizationPass(M, "SPIRVLowerMemmove");
131117
return true;
132118
}
133119

0 commit comments

Comments
 (0)