45
45
#include " llvm/Support/Signals.h"
46
46
#include " llvm/Support/raw_ostream.h"
47
47
#include " llvm/Support/xxhash.h"
48
+ #include " llvm/Target/TargetVerifier.h"
48
49
#include < unordered_map>
49
50
#include < unordered_set>
50
51
#include < utility>
@@ -1461,9 +1462,10 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks(
1461
1462
}
1462
1463
1463
1464
void VerifyInstrumentation::registerCallbacks (PassInstrumentationCallbacks &PIC,
1464
- ModuleAnalysisManager *MAM) {
1465
+ ModuleAnalysisManager *MAM,
1466
+ FunctionAnalysisManager *FAM) {
1465
1467
PIC.registerAfterPassCallback (
1466
- [this , MAM](StringRef P, Any IR, const PreservedAnalyses &PassPA) {
1468
+ [this , MAM, FAM ](StringRef P, Any IR, const PreservedAnalyses &PassPA) {
1467
1469
if (isIgnored (P) || P == " VerifierPass" )
1468
1470
return ;
1469
1471
const auto *F = unwrapIR<Function>(IR);
@@ -1480,6 +1482,15 @@ void VerifyInstrumentation::registerCallbacks(PassInstrumentationCallbacks &PIC,
1480
1482
report_fatal_error (formatv (" Broken function found after pass "
1481
1483
" \" {0}\" , compilation aborted!" ,
1482
1484
P));
1485
+
1486
+ if (FAM) {
1487
+ TargetVerify TV (const_cast <Module*>(F->getParent ()));
1488
+ TV.run (*const_cast <Function*>(F), *FAM);
1489
+ if (!F->getParent ()->IsValid )
1490
+ report_fatal_error (formatv (" Broken function found after pass "
1491
+ " \" {0}\" , compilation aborted!" ,
1492
+ P));
1493
+ }
1483
1494
} else {
1484
1495
const auto *M = unwrapIR<Module>(IR);
1485
1496
if (!M) {
@@ -2524,7 +2535,7 @@ void PrintCrashIRInstrumentation::registerCallbacks(
2524
2535
}
2525
2536
2526
2537
void StandardInstrumentations::registerCallbacks (
2527
- PassInstrumentationCallbacks &PIC, ModuleAnalysisManager *MAM) {
2538
+ PassInstrumentationCallbacks &PIC, ModuleAnalysisManager *MAM, FunctionAnalysisManager *FAM ) {
2528
2539
PrintIR.registerCallbacks (PIC);
2529
2540
PrintPass.registerCallbacks (PIC);
2530
2541
TimePasses.registerCallbacks (PIC);
@@ -2533,7 +2544,7 @@ void StandardInstrumentations::registerCallbacks(
2533
2544
PrintChangedIR.registerCallbacks (PIC);
2534
2545
PseudoProbeVerification.registerCallbacks (PIC);
2535
2546
if (VerifyEach)
2536
- Verify.registerCallbacks (PIC, MAM);
2547
+ Verify.registerCallbacks (PIC, MAM, FAM );
2537
2548
PrintChangedDiff.registerCallbacks (PIC);
2538
2549
WebsiteChangeReporter.registerCallbacks (PIC);
2539
2550
ChangeTester.registerCallbacks (PIC);
0 commit comments