Kaynağa Gözat

Fix build warnings (#832)

Change DXASSERT to DXASSERT_LOCALVAR to suppress warning
Young Kim 7 yıl önce
ebeveyn
işleme
92c66ed574

+ 3 - 5
lib/HLSL/DxilGenerationPass.cpp

@@ -1925,8 +1925,7 @@ void DxilTranslateRawBuffer::ReplaceRawBufferLoad(Function *F,
 void DxilTranslateRawBuffer::ReplaceRawBufferStore(Function *F,
   Module &M) {
   OP *op = M.GetDxilModule().GetOP();
-  Type *RTy = F->getReturnType();
-  DXASSERT(RTy->isVoidTy(), "rawBufferStore should return a void type.");
+  DXASSERT(F->getReturnType()->isVoidTy(), "rawBufferStore should return a void type.");
   Type *ETy = F->getFunctionType()->getParamType(4); // value
   Function *newFunction = op->GetOpFunc(hlsl::DXIL::OpCode::BufferStore, ETy);
   for (auto U = F->user_begin(), E = F->user_end(); U != E;) {
@@ -1969,8 +1968,7 @@ void DxilTranslateRawBuffer::ReplaceMinPrecisionRawBufferLoad(Function *F,
 
 void DxilTranslateRawBuffer::ReplaceMinPrecisionRawBufferStore(Function *F,
                                                               Module &M) {
-  Type *RetTy = F->getReturnType();
-  DXASSERT(RetTy->isVoidTy(), "rawBufferStore should return a void type.");
+  DXASSERT(F->getReturnType()->isVoidTy(), "rawBufferStore should return a void type.");
   Type *ETy = F->getFunctionType()->getParamType(4); // value
   Type *NewETy;
   if (ETy->isHalfTy()) {
@@ -2012,7 +2010,7 @@ void DxilTranslateRawBuffer::ReplaceMinPrecisionRawBufferStore(Function *F,
       CallInst *handleCI = dyn_cast<CallInst>(CI->getArgOperand(1));
       DXASSERT(handleCI, "otherwise handle was not an argument to buffer store.");
       ConstantInt *resClass = dyn_cast<ConstantInt>(handleCI->getArgOperand(1));
-      DXASSERT(resClass && resClass->getSExtValue() ==
+      DXASSERT_LOCALVAR(resClass, resClass && resClass->getSExtValue() ==
                                (unsigned)DXIL::ResourceClass::UAV,
                "otherwise buffer store called on non uav kind.");
       ConstantInt *rangeID = dyn_cast<ConstantInt>(handleCI->getArgOperand(2)); // range id or idx?

+ 1 - 1
lib/HLSL/HLOperationLower.cpp

@@ -4875,7 +4875,7 @@ Value *GenerateCBLoadLegacy(Value *handle, Value *legacyIdx,
   bool is64 = (EltTy == doubleTy) | (EltTy == i64Ty);
   bool is16 = (EltTy == halfTy || EltTy == i16Ty) && !hlslOP->UseMinPrecision();
   bool isNormal = !isBool && !is64;
-  DXASSERT((is16 && channelOffset < 8) || channelOffset < 4,
+  DXASSERT_LOCALVAR(is16, (is16 && channelOffset < 8) || channelOffset < 4,
            "legacy cbuffer don't across 16 bytes register.");
   if (isNormal) {
     Function *CBLoad = hlslOP->GetOpFunc(OP::OpCode::CBufferLoadLegacy, EltTy);