@@ -480,22 +480,6 @@ bool swift::performLLVM(const IRGenOptions &Opts,
480
480
const version::Version &effectiveLanguageVersion,
481
481
StringRef OutputFilename,
482
482
UnifiedStatsReporter *Stats) {
483
- #ifndef NDEBUG
484
- // FIXME: Some bots are failing. See: rdar://54708850
485
- // #define DEBUG_VERIFY_GENERATED_CODE
486
- #endif
487
-
488
- #ifdef DEBUG_VERIFY_GENERATED_CODE
489
- // To check that we only skip generating code when it would have no effect, in
490
- // assertion builds we still generate the code, but write it into a temporary
491
- // file that we compare to the original file.
492
-
493
- // / The OutputFilename originally passed to us, if we are generating code for
494
- // / an assertion. Empty if not.
495
- StringRef OriginalOutputFilename = " " ;
496
- // / Scratch buffer for temporary file's name.
497
- SmallString<64 > AssertScratch;
498
- #endif
499
483
500
484
if (Opts.UseIncrementalLLVMCodeGen && HashGlobal) {
501
485
// Check if we can skip the llvm part of the compilation if we have an
@@ -518,24 +502,7 @@ bool swift::performLLVM(const IRGenOptions &Opts,
518
502
!Opts.PrintInlineTree &&
519
503
!needsRecompile (OutputFilename, HashData, HashGlobal, DiagMutex)) {
520
504
// The llvm IR did not change. We don't need to re-create the object file.
521
- #ifndef DEBUG_VERIFY_GENERATED_CODE
522
505
return false ;
523
- #else
524
- // ...but we're in an asserts build, so we want to check that assumption.
525
- auto AssertSuffix = llvm::sys::path::filename (OutputFilename);
526
-
527
- auto EC = llvm::sys::fs::createTemporaryFile (" assert" , AssertSuffix,
528
- AssertScratch);
529
- if (EC) {
530
- diagnoseSync (Diags, DiagMutex,
531
- SourceLoc (), diag::error_opening_output,
532
- AssertScratch, EC.message ());
533
- return true ;
534
- }
535
-
536
- OriginalOutputFilename = OutputFilename;
537
- OutputFilename = AssertScratch;
538
- #endif
539
506
}
540
507
541
508
// Store the hash in the global variable so that it is written into the
@@ -622,42 +589,6 @@ bool swift::performLLVM(const IRGenOptions &Opts,
622
589
if (DiagMutex)
623
590
DiagMutex->unlock ();
624
591
}
625
- #ifdef DEBUG_VERIFY_GENERATED_CODE
626
- if (!OriginalOutputFilename.empty ()) {
627
- // We're done changing the file; make sure it's saved before we compare.
628
- RawOS->close ();
629
-
630
- auto result =
631
- swift::areFilesDifferent (OutputFilename, OriginalOutputFilename,
632
- /* allowDestinationErrors=*/ false );
633
-
634
- if (!result)
635
- // File system error.
636
- llvm::report_fatal_error (
637
- Twine (" Error comparing files: " ) + result.getError ().message ()
638
- );
639
-
640
- switch (*result) {
641
- case FileDifference::DifferentContents:
642
- llvm::report_fatal_error (
643
- " Swift skipped an LLVM compile that would have changed output; pass "
644
- " -Xfrontend -disable-incremental-llvm-codegen to work around this bug"
645
- );
646
- // Note for future debuggers: If you see this error, either you changed
647
- // LLVM and need to clean your build folder to rebuild everything with it,
648
- // or IRGenOptions::writeLLVMCodeGenOptionsTo() doesn't account for a flag
649
- // that changed LLVM's output between this compile and the previous one.
650
-
651
- case FileDifference::SameContents:
652
- // Removing the file is best-effort.
653
- (void )llvm::sys::fs::remove (OutputFilename);
654
- break ;
655
-
656
- case FileDifference::IdenticalFile:
657
- llvm_unreachable (" one of these should be a temporary file" );
658
- }
659
- }
660
- #endif
661
592
662
593
return false ;
663
594
}
0 commit comments