verify-uselistorder: Make the verification logic easier to reuse

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214587 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2014-08-01 22:52:06 +00:00
parent 4a6fa1390a
commit 236c1ac873

View File

@ -359,6 +359,15 @@ static bool verifyAssemblyUseListOrder(const Module &M) {
return matches(ValueMapping(M), ValueMapping(*OtherM)); return matches(ValueMapping(M), ValueMapping(*OtherM));
} }
static void verifyUseListOrder(const Module &M) {
if (!verifyBitcodeUseListOrder(M))
report_fatal_error("bitcode use-list order changed");
if (shouldPreserveAssemblyUseListOrder())
if (!verifyAssemblyUseListOrder(M))
report_fatal_error("assembly use-list order changed");
}
int main(int argc, char **argv) { int main(int argc, char **argv) {
sys::PrintStackTraceOnErrorSignal(); sys::PrintStackTraceOnErrorSignal();
llvm::PrettyStackTraceProgram X(argc, argv); llvm::PrettyStackTraceProgram X(argc, argv);
@ -397,12 +406,7 @@ int main(int argc, char **argv) {
// Shuffle with a different seed each time so that use-lists that aren't // Shuffle with a different seed each time so that use-lists that aren't
// modified the first time are likely to be modified the next time. // modified the first time are likely to be modified the next time.
shuffleUseLists(*M, I); shuffleUseLists(*M, I);
if (!verifyBitcodeUseListOrder(*M)) verifyUseListOrder(*M);
report_fatal_error("bitcode use-list order changed");
if (shouldPreserveAssemblyUseListOrder())
if (!verifyAssemblyUseListOrder(*M))
report_fatal_error("assembly use-list order changed");
} }
return 0; return 0;