Sfoglia il codice sorgente

Fix debug flags for non-debug VS builds (#364)

The DBG define was set even for release builds.
Marcelo Lopez Ruiz 8 anni fa
parent
commit
23f9b82096

+ 4 - 1
cmake/modules/HandleLLVMOptions.cmake

@@ -60,7 +60,9 @@ if( LLVM_ENABLE_ASSERTIONS )
   if( NOT MSVC )
     add_definitions( -D_DEBUG )
   endif()
-  add_definitions( -DDBG ) # HLSL Change
+  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDBG") # HLSL Change
+  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -UNDEBUG") # HLSL Change
+  if (0) # HLSL Change Starts
   # On non-Debug builds cmake automatically defines NDEBUG, so we
   # explicitly undefine it:
   if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
@@ -77,6 +79,7 @@ if( LLVM_ENABLE_ASSERTIONS )
         "${flags_var_to_scrub}" "${${flags_var_to_scrub}}")
     endforeach()
   endif()
+  endif (0) # HLSL Change Ends
 endif()
 
 string(TOUPPER "${LLVM_ABI_BREAKING_CHECKS}" uppercase_LLVM_ABI_BREAKING_CHECKS)

+ 3 - 3
lib/HLSL/DxilGenerationPass.cpp

@@ -1174,8 +1174,8 @@ void GenerateInputOutputUserCall(InputOutputAccessInfo &info, Value *undefVertex
       } else {
         Value *V = stInst->getValueOperand();
         Type *Ty = V->getType();
-        DXASSERT(Ty == Ty->getScalarType() && !Ty->isAggregateType(),
-                 "only support scalar here");
+        DXASSERT_LOCALVAR(Ty, Ty == Ty->getScalarType() && !Ty->isAggregateType(),
+                          "only support scalar here");
 
         if (ConstantInt *ColIdx = dyn_cast<ConstantInt>(info.vectorIdx)) {
           IRBuilder<> Builder(stInst);
@@ -3501,4 +3501,4 @@ ModulePass *llvm::createDxilLegalizeEvalOperationsPass() {
 
 INITIALIZE_PASS(DxilLegalizeEvalOperations,
                 "hlsl-dxil-legalize-eval-operations",
-                "DXIL legalize eval operations", false, false)
+                "DXIL legalize eval operations", false, false)

+ 1 - 1
lib/HLSL/DxilOperations.cpp

@@ -432,8 +432,8 @@ void OP::RefreshCache() {
       OpCode OpCode = OP::GetDxilOpFuncCallInst(CI);
       Type *pOverloadType = OP::GetOverloadType(OpCode, &F);
       Function *OpFunc = GetOpFunc(OpCode, pOverloadType);
+      (OpFunc);
       DXASSERT_NOMSG(OpFunc == &F);
-
     }
   }
 }

+ 4 - 3
lib/HLSL/HLMatrixLowerPass.cpp

@@ -2309,9 +2309,10 @@ void HLMatrixLowerPass::runOnFunction(Function &F) {
         if (group == HLOpcodeGroup::HLMatLoadStore) {
           HLMatLoadStoreOpcode opcode =
               static_cast<HLMatLoadStoreOpcode>(hlsl::GetHLOpcode(CI));
-          DXASSERT(opcode == HLMatLoadStoreOpcode::ColMatStore ||
-                       opcode == HLMatLoadStoreOpcode::RowMatStore,
-                   "Must MatStore here, load will go IsMatrixType path");
+          DXASSERT_LOCALVAR(opcode,
+                            opcode == HLMatLoadStoreOpcode::ColMatStore ||
+                            opcode == HLMatLoadStoreOpcode::RowMatStore,
+                            "Must MatStore here, load will go IsMatrixType path");
           // Lower it here to make sure it is ready before replace.
           lowerToVec(&I);
         }

+ 1 - 1
lib/HLSL/HLOperationLower.cpp

@@ -280,7 +280,7 @@ private:
   Value *CreateResourceForCbPtr(GetElementPtrInst *CbPtr, GlobalVariable *CbGV,
                                 MDNode *MD) {
     Type *CbTy = CbPtr->getPointerOperandType();
-    DXASSERT_NOMSG(CbTy == CbGV->getType());
+    DXASSERT_LOCALVAR(CbTy, CbTy == CbGV->getType(), "else arg not point to var");
 
     gep_type_iterator GEPIt = gep_type_begin(CbPtr), E = gep_type_end(CbPtr);
     unsigned i = 0;