@@ -29,9 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2929#include " Compiler/IGCPassSupport.h"
3030#include " Compiler/CISACodeGen/CISACodeGen.h"
3131#include " Compiler/Optimizer/OCLBIUtils.h"
32-
3332#include " LLVM3DBuilder/MetadataBuilder.h"
34-
3533#include " common/LLVMWarningsPush.hpp"
3634#include " llvm/ADT/SCCIterator.h"
3735#include < llvm/IR/Module.h>
@@ -41,12 +39,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4139#include < llvm/IR/DerivedTypes.h>
4240#include " llvm/IR/DIBuilder.h"
4341#include " common/LLVMWarningsPop.hpp"
44-
4542#include " Compiler/DebugInfo/VISADebugEmitter.hpp"
4643#include " common/debug/Debug.hpp"
47-
4844#include < map>
4945#include < utility>
46+ #include " Probe.h"
5047
5148using namespace llvm ;
5249using namespace IGC ;
@@ -162,7 +159,7 @@ bool AddImplicitArgs::runOnModule(Module &M)
162159 {
163160 Function* pFunc = I->first ;
164161
165- assert (pFunc->use_empty () && " Assume all user function are inlined at this point" );
162+ IGC_ASSERT (pFunc->use_empty () && " Assume all user function are inlined at this point" );
166163
167164 // Now, after changing funciton signature,
168165 // and validate there are no calls to the old function we can erase it.
@@ -308,12 +305,12 @@ void AddImplicitArgs::updateNewFuncArgs(llvm::Function* pFunc, llvm::Function* p
308305 // struct, image
309306 FunctionInfoMetaDataHandle funcInfo = m_pMdUtils->getFunctionsInfoItem (pFunc);
310307 ArgInfoMetaDataHandle argInfo = funcInfo->getImplicitArgInfoListItem (i);
311- assert (argInfo->isExplicitArgNumHasValue () && " wrong data in MetaData" );
308+ IGC_ASSERT (argInfo->isExplicitArgNumHasValue () && " wrong data in MetaData" );
312309
313310 info.DW0 .All .argExplictNum = argInfo->getExplicitArgNum ();
314311 if (argId <= ImplicitArg::ArgType::STRUCT_END)
315312 {
316- assert (argInfo->isStructArgOffsetHasValue () && " wrong data in MetaData" );
313+ IGC_ASSERT (argInfo->isStructArgOffsetHasValue () && " wrong data in MetaData" );
317314 info.DW0 .All .argOffset = argInfo->getStructArgOffset ();
318315 }
319316 infoToArg[info.DW0 .Value ] = &(*currArg);
@@ -328,7 +325,7 @@ void AddImplicitArgs::updateNewFuncArgs(llvm::Function* pFunc, llvm::Function* p
328325
329326void AddImplicitArgs::replaceAllUsesWithNewOCLBuiltinFunction (CodeGenContext* ctx, llvm::Function* old_func, llvm::Function* new_func)
330327{
331- assert (!old_func->use_empty ());
328+ IGC_ASSERT (!old_func->use_empty ());
332329
333330 FunctionInfoMetaDataHandle subFuncInfo = m_pMdUtils->getFunctionsInfoItem (old_func);
334331
@@ -371,7 +368,7 @@ void AddImplicitArgs::replaceAllUsesWithNewOCLBuiltinFunction(CodeGenContext* ct
371368
372369 if (!cInst)
373370 {
374- assert ( 0 && " Unknown function usage" );
371+ IGC_ASSERT ( false && " Unknown function usage" );
375372 getAnalysis<CodeGenContextWrapper>().getCodeGenContext ()->EmitError (" undefined reference to `jmp()' " );
376373 return ;
377374 }
@@ -389,7 +386,7 @@ void AddImplicitArgs::replaceAllUsesWithNewOCLBuiltinFunction(CodeGenContext* ct
389386 llvm::Function::arg_iterator new_arg_iter = new_func->arg_begin ();
390387 llvm::Function::arg_iterator new_arg_end = new_func->arg_end ();
391388
392- assert (IGCLLVM::GetFuncArgSize (new_func) >= numArgOperands);
389+ IGC_ASSERT (IGCLLVM::GetFuncArgSize (new_func) >= numArgOperands);
393390
394391 // basic arguments
395392 for (unsigned int i = 0 ; i < numArgOperands; ++i, ++new_arg_iter)
@@ -423,39 +420,39 @@ void AddImplicitArgs::replaceAllUsesWithNewOCLBuiltinFunction(CodeGenContext* ct
423420
424421 if (argId < ImplicitArg::ArgType::STRUCT_START)
425422 {
426- assert (infoToArg.find (info.DW0 .Value ) != infoToArg.end () &&
423+ IGC_ASSERT (infoToArg.find (info.DW0 .Value ) != infoToArg.end () &&
427424 " Can't find the implicit argument on parent function" );
428425 new_args.push_back (infoToArg[info.DW0 .Value ]);
429426 }
430427 else if (argId <= ImplicitArg::ArgType::STRUCT_END)
431428 {
432- assert ( 0 && " wrong argument type in user function" );
429+ IGC_ASSERT ( false && " wrong argument type in user function" );
433430 }
434431 else if (argId <= ImplicitArg::IMAGES_END || argId == ImplicitArg::ArgType::GET_OBJECT_ID || argId == ImplicitArg::ArgType::GET_BLOCK_SIMD_SIZE)
435432 {
436433 // special handling for image info types, such as ImageWidth, ImageHeight, ...
437434 // and struct type
438435
439- assert (argImpToExpNum.find (&(*new_arg_iter)) != argImpToExpNum.end () &&
436+ IGC_ASSERT (argImpToExpNum.find (&(*new_arg_iter)) != argImpToExpNum.end () &&
440437 " Can't find explicit argument number" );
441438
442439 // tracing it on parent function argument list
443440 Value* callArg = CImagesBI::CImagesUtils::traceImageOrSamplerArgument (cInst, argImpToExpNum[&(*new_arg_iter)]);
444441 Argument* arg = dyn_cast<Argument>(callArg);
445442
446- assert (arg && " Not supported" );
443+ IGC_ASSERT (arg && " Not supported" );
447444
448445 // build info
449446
450447 info.DW0 .All .argExplictNum = arg->getArgNo ();
451- assert (infoToArg.find (info.DW0 .Value ) != infoToArg.end () &&
448+ IGC_ASSERT (infoToArg.find (info.DW0 .Value ) != infoToArg.end () &&
452449 " Can't find the implicit argument on parent function" );
453450
454451 new_args.push_back (infoToArg[info.DW0 .Value ]);
455452 }
456453 else
457454 {
458- assert (infoToArg.find (info.DW0 .Value ) != infoToArg.end () &&
455+ IGC_ASSERT (infoToArg.find (info.DW0 .Value ) != infoToArg.end () &&
459456 " Can't find the implicit argument on parent function" );
460457 new_args.push_back (infoToArg[info.DW0 .Value ]);
461458 }
@@ -543,7 +540,7 @@ bool BuiltinCallGraphAnalysis::runOnModule(Module &M)
543540 !ctx->m_DriverInfo .AllowRecursion () &&
544541 hasRecursion (CG))
545542 {
546- assert ( 0 && " Recursion detected!" );
543+ IGC_ASSERT ( false && " Recursion detected!" );
547544 ctx->EmitError (" undefined reference to `jmp()' " );
548545 return false ;
549546 }
@@ -588,7 +585,7 @@ void BuiltinCallGraphAnalysis::traveseCallGraphSCC(const std::vector<CallGraphNo
588585
589586 // calculate args from sub-routine.
590587 // This function have not beeen processed yet, therefore no map-entry for it yet
591- assert (argMap.count (f) == 0 );
588+ IGC_ASSERT (argMap.count (f) == 0 );
592589 for (auto N : (*CGN))
593590 {
594591 Function *sub = N.second ->getFunction ();
@@ -597,7 +594,7 @@ void BuiltinCallGraphAnalysis::traveseCallGraphSCC(const std::vector<CallGraphNo
597594 // if we have processed the arguments for callee
598595 if (argMapIter != argMap.end ())
599596 {
600- assert ( argMapIter->second );
597+ IGC_ASSERT ( nullptr != argMapIter->second );
601598 combineTwoArgDetail (*argData, *(argMapIter->second ), N.first );
602599 }
603600 }
@@ -685,7 +682,7 @@ void BuiltinCallGraphAnalysis::combineTwoArgDetail(
685682 {
686683 // aggregate implicity argument
687684
688- assert ( 0 && " wrong location for this kind of argument type" );
685+ IGC_ASSERT ( false && " wrong location for this kind of argument type" );
689686
690687 }
691688 else if (argId <= ImplicitArg::ArgType::IMAGES_END || argId == ImplicitArg::ArgType::GET_OBJECT_ID || argId == ImplicitArg::ArgType::GET_BLOCK_SIMD_SIZE)
@@ -695,7 +692,7 @@ void BuiltinCallGraphAnalysis::combineTwoArgDetail(
695692 CallInst *cInst = dyn_cast<CallInst>(v);
696693 if (!cInst)
697694 {
698- assert ( 0 && " Not supported" );
695+ IGC_ASSERT ( false && " Not supported" );
699696 getAnalysis<CodeGenContextWrapper>().getCodeGenContext ()->EmitError (" undefined reference to `jmp()' " );
700697 return ;
701698 }
@@ -711,7 +708,7 @@ void BuiltinCallGraphAnalysis::combineTwoArgDetail(
711708 Argument* arg = dyn_cast<Argument>(callArg);
712709 if (!arg)
713710 {
714- assert ( 0 && " Not supported" );
711+ IGC_ASSERT ( false && " Not supported" );
715712 }
716713 setx->insert (arg->getArgNo ());
717714 }
@@ -729,7 +726,7 @@ void BuiltinCallGraphAnalysis::combineTwoArgDetail(
729726 // aggregate structure
730727 for (unsigned i = 0 ; i < argD.StructArgSet .size (); i++)
731728 {
732- assert ( 0 && " wrong argument type in user function" );
729+ IGC_ASSERT ( false && " wrong argument type in user function" );
733730 }
734731#endif
735732}
@@ -754,7 +751,7 @@ void BuiltinCallGraphAnalysis::writeBackAllIntoMetaData(ImplicitArgmentDetail& d
754751 {
755752 // aggregate implicity argument
756753
757- assert ( 0 && " wrong location for this kind of argument type" );
754+ IGC_ASSERT ( false && " wrong location for this kind of argument type" );
758755
759756 }
760757 else if (argId <= ImplicitArg::ArgType::IMAGES_END || argId == ImplicitArg::ArgType::GET_OBJECT_ID || argId == ImplicitArg::ArgType::GET_BLOCK_SIMD_SIZE)
0 commit comments