[PATCH] D134071: [SPIRV] fix build with clang and use PoisonValue instead of UndefValue

Ilia Diachkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 16 13:05:46 PDT 2022


iliya-diyachkov created this revision.
iliya-diyachkov added reviewers: zuban32, konrad.trifunovic, mpaszkowski, nlopes, thewilsonator.
Herald added subscribers: ThomasRaoux, hiraditya.
Herald added a project: All.
iliya-diyachkov requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The patch fixes the backend build by clang (https://github.com/llvm/llvm-project/issues/57773). Also it it replaces UndefValue with PoisonValue in SPIRVRegularizer.cpp as @nlopes asked.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134071

Files:
  llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
  llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp


Index: llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp
===================================================================
--- llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp
+++ llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp
@@ -221,12 +221,12 @@
   assert(NewF);
 
   auto ConstInt = ConstantInt::get(IntegerType::get(CI->getContext(), 32), 0);
-  UndefValue *UndefVal = UndefValue::get(Arg0Ty);
+  PoisonValue *PVal = PoisonValue::get(Arg0Ty);
   Instruction *Inst =
-      InsertElementInst::Create(UndefVal, CI->getOperand(1), ConstInt, "", CI);
+      InsertElementInst::Create(PVal, CI->getOperand(1), ConstInt, "", CI);
   ElementCount VecElemCount = cast<VectorType>(Arg0Ty)->getElementCount();
   Constant *ConstVec = ConstantVector::getSplat(VecElemCount, ConstInt);
-  Value *NewVec = new ShuffleVectorInst(Inst, UndefVal, ConstVec, "", CI);
+  Value *NewVec = new ShuffleVectorInst(Inst, PVal, ConstVec, "", CI);
   CI->setOperand(1, NewVec);
   CI->replaceUsesOfWith(OldF, NewF);
   CI->mutateFunctionType(NewF->getFunctionType());
Index: llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
===================================================================
--- llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -1795,7 +1795,7 @@
 
 namespace SPIRV {
 SPIRVType *lowerBuiltinType(const StructType *OpaqueType,
-                            AccessQualifier::AccessQualifier AccessQual,
+                            SPIRV::AccessQualifier::AccessQualifier AccessQual,
                             MachineIRBuilder &MIRBuilder,
                             SPIRVGlobalRegistry *GR) {
   assert(OpaqueType->hasName() &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134071.460863.patch
Type: text/x-patch
Size: 1642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220916/cc8f3e2d/attachment.bin>


More information about the llvm-commits mailing list