mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-25 14:50:26 +00:00
Fix several places that were calling verifyFunction or verifyModule without checking the return value.
verifyFunction/verifyModule don't assert or error internally. They also don't print anything if you don't pass a raw_ostream to them. So the caller needs to check the result and ideally pass a stream to get the messages. Otherwise they're just really expensive no-ops. I've filed PR45965 for another instance in SLPVectorizer that causes a lit test failure. Differential Revision: https://reviews.llvm.org/D80106
This commit is contained in:
parent
b783f70a42
commit
c9f63297e2
@ -1071,10 +1071,10 @@ bool WinEHPrepare::prepareExplicitEH(Function &F) {
|
||||
DemoteCatchSwitchPHIOnlyOpt);
|
||||
|
||||
if (!DisableCleanups) {
|
||||
LLVM_DEBUG(verifyFunction(F));
|
||||
assert(!verifyFunction(F, &dbgs()));
|
||||
removeImplausibleInstructions(F);
|
||||
|
||||
LLVM_DEBUG(verifyFunction(F));
|
||||
assert(!verifyFunction(F, &dbgs()));
|
||||
cleanupPreparedFunclets(F);
|
||||
}
|
||||
|
||||
|
@ -1292,7 +1292,8 @@ bool HexagonCommonGEP::runOnFunction(Function &F) {
|
||||
|
||||
#ifdef EXPENSIVE_CHECKS
|
||||
// Run this only when expensive checks are enabled.
|
||||
verifyFunction(F);
|
||||
if (verifyFunction(F, &dbgs()))
|
||||
report_fatal_error("Broken function");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -894,7 +894,8 @@ static void postSplitCleanup(Function &F) {
|
||||
// For now, we do a mandatory verification step because we don't
|
||||
// entirely trust this pass. Note that we don't want to add a verifier
|
||||
// pass to FPM below because it will also verify all the global data.
|
||||
verifyFunction(F);
|
||||
if (verifyFunction(F, &errs()))
|
||||
report_fatal_error("Broken function");
|
||||
|
||||
legacy::FunctionPassManager FPM(F.getParent());
|
||||
|
||||
|
@ -7669,7 +7669,7 @@ static bool processLoopInVPlanNativePath(
|
||||
// Mark the loop as already vectorized to avoid vectorizing again.
|
||||
Hints.setAlreadyVectorized();
|
||||
|
||||
LLVM_DEBUG(verifyFunction(*L->getHeader()->getParent()));
|
||||
assert(!verifyFunction(*L->getHeader()->getParent(), &dbgs()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -7971,7 +7971,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
|
||||
Hints.setAlreadyVectorized();
|
||||
}
|
||||
|
||||
LLVM_DEBUG(verifyFunction(*L->getHeader()->getParent()));
|
||||
assert(!verifyFunction(*L->getHeader()->getParent()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
if (!M.get())
|
||||
return 0;
|
||||
|
||||
verifyModule(*M.get());
|
||||
if (verifyModule(*M.get(), &errs()))
|
||||
report_fatal_error("Broken module");
|
||||
return 0;
|
||||
}
|
||||
|
@ -61,7 +61,11 @@ int main(int argc, char **argv) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
verifyModule(*MPart);
|
||||
if (verifyModule(*MPart, &errs())) {
|
||||
errs() << "Broken module!\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
WriteBitcodeToFile(*MPart, Out->os());
|
||||
|
||||
// Declare success.
|
||||
|
Loading…
Reference in New Issue
Block a user