Răsfoiți Sursa

Fix various Clang compiler warnings (#1558)

Lei Zhang 7 ani în urmă
părinte
comite
958ec32c06

+ 1 - 1
lib/DxrFallback/Reducibility.cpp

@@ -344,7 +344,7 @@ int makeReducible(Function* F)
         if (nodes[i]->in.size() <= 1)
           continue;
 
-        if (idxMin == ~0 || nodes[i]->numInstructions < nodes[idxMin]->numInstructions)
+        if (idxMin == size_t(~0) || nodes[i]->numInstructions < nodes[idxMin]->numInstructions)
           idxMin = i;
       }
       nodes.push_back(split(nodes[idxMin], bbToNode, numSplits == 0));

+ 0 - 19
lib/DxrFallback/StateFunctionTransform.cpp

@@ -95,16 +95,6 @@ static std::string stripSuffix(StringRef name, StringRef suffix)
 }
 
 
-static std::string stripAfter(StringRef name, StringRef suffixStart)
-{
-  size_t pos = name.find(suffixStart);
-  if (pos != name.npos)
-    return name.substr(0, pos).str();
-  else
-    return name.str();
-}
-
-
 // Insert str before the final "." in filename.
 static std::string insertBeforeExtension(const std::string& filename, const std::string& str)
 {
@@ -1285,15 +1275,6 @@ void StateFunctionTransform::rewriteDummyStackSize(uint64_t frameSizeInBytes)
   m_stackFrameSizeVal = frameSizeVal;
 }
 
-static inline Value* toIntIndex(int offsetInBytes, Value* baseOffset, Instruction* insertBefore)
-{
-  assert(offsetInBytes % sizeof(int) == 0);
-  Value* intIndex = makeInt32(offsetInBytes / sizeof(int), insertBefore->getContext());
-  if (baseOffset)
-    intIndex = BinaryOperator::Create(Instruction::Add, intIndex, baseOffset, "", insertBefore);
-  return intIndex;
-}
-
 void StateFunctionTransform::createStackStore(Value* baseOffset, Value* val, int offsetInBytes, Instruction* insertBefore)
 {
   assert(offsetInBytes % sizeof(int) == 0);

+ 1 - 2
lib/HLSL/DxilContainerAssembler.cpp

@@ -856,9 +856,8 @@ class StringBufferPart : public RDATPart {
 private:
   StringMap<uint32_t> m_StringMap;
   SmallVector<char, 256> m_StringBuffer;
-  uint32_t curIndex;
 public:
-  StringBufferPart() : m_StringMap(), m_StringBuffer(), curIndex(0) {
+  StringBufferPart() : m_StringMap(), m_StringBuffer() {
     // Always start string table with null so empty/null strings have offset of zero
     m_StringBuffer.push_back('\0');
   }

+ 1 - 7
lib/HLSL/DxilPatchShaderRecordBindings.cpp

@@ -386,11 +386,6 @@ DXIL::ShaderKind GetRayShaderKindCopy(Function* F)
     return DXIL::ShaderKind::Invalid;
 }
 
-static std::string ws2s(const std::wstring& wide)
-{
-    return std::string(wide.begin(), wide.end());
-}
-
 bool DxilPatchShaderRecordBindings::runOnModule(Module &M) {
   DxilModule &DM = M.GetOrCreateDxilModule();
   EntryPointFunction = pInputShaderInfo->ExportName ? getFunctionFromName(M, pInputShaderInfo->ExportName) : DM.GetEntryFunction();
@@ -834,7 +829,7 @@ void DxilPatchShaderRecordBindings::InitializeViewTable() {
     // manually add it to the list of UAV register spaces used
     if (*pInputShaderInfo->pNumUAVSpaces == 0)
     {
-        ViewKey key = { (unsigned int)hlsl::DXIL::ResourceKind::RawBuffer, 0 };
+        ViewKey key = { (unsigned int)hlsl::DXIL::ResourceKind::RawBuffer, {0} };
         unsigned int index = FindOrInsertViewIntoList(
           key, 
           pInputShaderInfo->pUAVRegisterSpaceArray, 
@@ -854,7 +849,6 @@ void DxilPatchShaderRecordBindings::PatchShaderBindings(Module &M) {
   std::vector<llvm::Instruction *> instructionsToRemove;
   for (BasicBlock &block : EntryPointFunction->getBasicBlockList()) {
     auto & Instructions = block.getInstList();
-    auto It = Instructions.begin();
 
     for (auto &instr : Instructions) {
       DxilInst_CreateHandleForLib createHandleForLib(&instr);

+ 0 - 2
lib/HLSL/DxilValidation.cpp

@@ -2342,8 +2342,6 @@ static void ValidateDxilOperationCallInProfile(CallInst *CI,
     const unsigned uglobal =
         static_cast<unsigned>(DXIL::BarrierMode::UAVFenceGlobal);
     const unsigned g = static_cast<unsigned>(DXIL::BarrierMode::TGSMFence);
-    const unsigned t =
-        static_cast<unsigned>(DXIL::BarrierMode::SyncThreadGroup);
     const unsigned ut =
         static_cast<unsigned>(DXIL::BarrierMode::UAVFenceThreadGroup);
     unsigned barrierMode = cMode->getLimitedValue();