Skip to content

Commit e1e14db

Browse files
svenvhsys-ce-bb
authored andcommitted
Explicitly set clang-format binary (#2123)
Ensure the correct clang-format binary is picked up, as `clang-format-diff.py` currently seems to look for clang-format-17 while we install clang-format-18. Original commit: KhronosGroup/SPIRV-LLVM-Translator@2bb5fed
1 parent 9e2c685 commit e1e14db

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

llvm-spirv/.github/workflows/check-code-style.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ jobs:
8282
if: ${{ steps.gather-list-of-changes.outputs.HAS_CHANGES }}
8383
id: run-clang-format
8484
run: |
85-
cat diff-to-inspect.txt | /usr/share/clang/clang-format-${{ env.LLVM_VERSION }}/clang-format-diff.py -p1 > clang-format.patch
85+
cat diff-to-inspect.txt | /usr/share/clang/clang-format-${{ env.LLVM_VERSION }}/clang-format-diff.py \
86+
-p1 -binary clang-format-${{ env.LLVM_VERSION }} > clang-format.patch
8687
if [ -s clang-format.patch ]; then
8788
echo "clang-format found incorrectly formatted code:"
8889
cat clang-format.patch;

llvm-spirv/lib/SPIRV/SPIRVReader.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,8 +1609,8 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
16091609
if (BVar->isBuiltin(&BVKind))
16101610
BV->setName(prefixSPIRVName(SPIRVBuiltInNameMap::map(BVKind)));
16111611
auto *LVar = new GlobalVariable(*M, Ty, IsConst, LinkageTy,
1612-
/*Initializer=*/nullptr, BV->getName(), 0,
1613-
GlobalVariable::NotThreadLocal, AddrSpace);
1612+
/*Initializer=*/nullptr, BV->getName(), 0,
1613+
GlobalVariable::NotThreadLocal, AddrSpace);
16141614
auto *Res = mapValue(BV, LVar);
16151615
if (Init)
16161616
Initializer = dyn_cast<Constant>(transValue(Init, F, BB, false));
@@ -1907,7 +1907,8 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
19071907
auto *Vector = transValue(VTS->getVector(), F, BB);
19081908
auto *VecTy = cast<FixedVectorType>(Vector->getType());
19091909
unsigned VecSize = VecTy->getNumElements();
1910-
auto *NewVec = Builder.CreateVectorSplat(VecSize, Scalar, Scalar->getName());
1910+
auto *NewVec =
1911+
Builder.CreateVectorSplat(VecSize, Scalar, Scalar->getName());
19111912
NewVec->takeName(Scalar);
19121913
auto *Scale = Builder.CreateFMul(Vector, NewVec, "scale");
19131914
return mapValue(BV, Scale);
@@ -1963,7 +1964,8 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
19631964
uint64_t ColNum = Matrix->getType()->getArrayNumElements();
19641965
auto *ColType = cast<ArrayType>(Matrix->getType())->getElementType();
19651966
auto VecSize = cast<FixedVectorType>(ColType)->getNumElements();
1966-
auto *NewVec = Builder.CreateVectorSplat(VecSize, Scalar, Scalar->getName());
1967+
auto *NewVec =
1968+
Builder.CreateVectorSplat(VecSize, Scalar, Scalar->getName());
19671969
NewVec->takeName(Scalar);
19681970

19691971
Value *V = UndefValue::get(Matrix->getType());
@@ -2339,8 +2341,8 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
23392341
case OpFunctionCall: {
23402342
SPIRVFunctionCall *BC = static_cast<SPIRVFunctionCall *>(BV);
23412343
auto *Call = CallInst::Create(transFunction(BC->getFunction()),
2342-
transValue(BC->getArgumentValues(), F, BB),
2343-
BC->getName(), BB);
2344+
transValue(BC->getArgumentValues(), F, BB),
2345+
BC->getName(), BB);
23442346
setCallingConv(Call);
23452347
setAttrByCalledFunc(Call);
23462348
return mapValue(BV, Call);
@@ -2458,7 +2460,7 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
24582460
case OpFNegate: {
24592461
SPIRVUnary *BC = static_cast<SPIRVUnary *>(BV);
24602462
auto *Neg = UnaryOperator::CreateFNeg(transValue(BC->getOperand(0), F, BB),
2461-
BV->getName(), BB);
2463+
BV->getName(), BB);
24622464
applyFPFastMathModeDecorations(BV, Neg);
24632465
return mapValue(BV, Neg);
24642466
}
@@ -4064,7 +4066,8 @@ bool SPIRVToLLVM::transMetadata() {
40644066
}
40654067
// Generate metadata for intel_reqd_sub_group_size
40664068
if (auto *EM = BF->getExecutionMode(ExecutionModeSubgroupSize)) {
4067-
auto *SizeMD = ConstantAsMetadata::get(getUInt32(M, EM->getLiterals()[0]));
4069+
auto *SizeMD =
4070+
ConstantAsMetadata::get(getUInt32(M, EM->getLiterals()[0]));
40684071
F->setMetadata(kSPIR2MD::SubgroupSize, MDNode::get(*Context, SizeMD));
40694072
}
40704073
// Generate metadata for max_work_group_size

0 commit comments

Comments
 (0)