Skip to content

Commit

Permalink
[Attributor][NFC] Run the verifier only on functions and under EXPENS…
Browse files Browse the repository at this point in the history
…IVE_CHECKS

Running the verifier is expensive so we want to avoid it even in runs
that enable assertions. As we move closer to enabling the Attributor
this code will be executed by some buildbots but not cause overhead for
most people.
  • Loading branch information
jdoerfert committed Apr 16, 2020
1 parent 8e14086 commit ad9c284
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions llvm/lib/Transforms/IPO/Attributor.cpp
Expand Up @@ -1248,6 +1248,14 @@ ChangeStatus Attributor::run() {
"specified iterations!");
}

#ifdef EXPENSIVE_CHECKS
for (Function *F : Functions) {
if (ToBeDeletedFunctions.count(F))
continue;
assert(!verifyFunction(*F, &errs()) && "Module verification failed!");
}
#endif

return ManifestChange;
}

Expand Down Expand Up @@ -1982,10 +1990,7 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache,
A.identifyDefaultAbstractAttributes(*F);
}

Module &M = *Functions.front()->getParent();
(void)M;
ChangeStatus Changed = A.run();
assert(!verifyModule(M, &errs()) && "Module verification failed!");
LLVM_DEBUG(dbgs() << "[Attributor] Done with " << Functions.size()
<< " functions, result: " << Changed << ".\n");
return Changed == ChangeStatus::CHANGED;
Expand Down

0 comments on commit ad9c284

Please sign in to comment.