@@ -360,7 +360,9 @@ void coro::Shape::buildFrom(Function &F) {
360
360
for (auto AnySuspend : CoroSuspends) {
361
361
auto Suspend = dyn_cast<CoroSuspendInst>(AnySuspend);
362
362
if (!Suspend) {
363
+ #ifndef NDEBUG
363
364
AnySuspend->dump ();
365
+ #endif
364
366
report_fatal_error (" coro.id must be paired with coro.suspend" );
365
367
}
366
368
@@ -392,7 +394,9 @@ void coro::Shape::buildFrom(Function &F) {
392
394
for (auto AnySuspend : CoroSuspends) {
393
395
auto Suspend = dyn_cast<CoroSuspendRetconInst>(AnySuspend);
394
396
if (!Suspend) {
397
+ #ifndef NDEBUG
395
398
AnySuspend->dump ();
399
+ #endif
396
400
report_fatal_error (" coro.id.retcon.* must be paired with "
397
401
" coro.suspend.retcon" );
398
402
}
@@ -402,15 +406,19 @@ void coro::Shape::buildFrom(Function &F) {
402
406
auto RI = ResultTys.begin (), RE = ResultTys.end ();
403
407
for (; SI != SE && RI != RE; ++SI, ++RI) {
404
408
if ((*SI)->getType () != *RI) {
409
+ #ifndef NDEBUG
405
410
Suspend->dump ();
406
411
Prototype->getFunctionType ()->dump ();
412
+ #endif
407
413
report_fatal_error (" argument to coro.suspend.retcon does not "
408
414
" match corresponding prototype function result" );
409
415
}
410
416
}
411
417
if (SI != SE || RI != RE) {
418
+ #ifndef NDEBUG
412
419
Suspend->dump ();
413
420
Prototype->getFunctionType ()->dump ();
421
+ #endif
414
422
report_fatal_error (" wrong number of arguments to coro.suspend.retcon" );
415
423
}
416
424
@@ -421,14 +429,18 @@ void coro::Shape::buildFrom(Function &F) {
421
429
? cast<StructType>(SResultTy)->elements ()
422
430
: SResultTy); // forms an ArrayRef using SResultTy, be careful
423
431
if (SuspendResultTys.size () != ResumeTys.size ()) {
432
+ #ifndef NDEBUG
424
433
Suspend->dump ();
425
434
Prototype->getFunctionType ()->dump ();
435
+ #endif
426
436
report_fatal_error (" wrong number of results from coro.suspend.retcon" );
427
437
}
428
438
for (size_t I = 0 , E = ResumeTys.size (); I != E; ++I) {
429
439
if (SuspendResultTys[I] != ResumeTys[I]) {
440
+ #ifndef NDEBUG
430
441
Suspend->dump ();
431
442
Prototype->getFunctionType ()->dump ();
443
+ #endif
432
444
report_fatal_error (" result from coro.suspend.retcon does not "
433
445
" match corresponding prototype function param" );
434
446
}
@@ -509,12 +521,14 @@ void coro::Shape::emitDealloc(IRBuilder<> &Builder, Value *Ptr,
509
521
510
522
LLVM_ATTRIBUTE_NORETURN
511
523
static void fail (const Instruction *I, const char *Reason, Value *V) {
524
+ #ifndef NDEBUG
512
525
I->dump ();
513
526
if (V) {
514
527
errs () << " Value: " ;
515
528
V->printAsOperand (llvm::errs ());
516
529
errs () << ' \n ' ;
517
530
}
531
+ #endif
518
532
report_fatal_error (Reason);
519
533
}
520
534
0 commit comments