llvm-uselistorder: Add -num-shuffles option

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214144 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2014-07-28 23:25:21 +00:00
parent 0ee7d91abd
commit a784589f57
2 changed files with 18 additions and 7 deletions

View File

@ -1,4 +1,4 @@
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
@a = global [4 x i1] [i1 0, i1 1, i1 0, i1 1]
@b = alias i1* getelementptr ([4 x i1]* @a, i64 0, i64 2)

View File

@ -43,6 +43,11 @@ static cl::opt<std::string> InputFilename(cl::Positional,
static cl::opt<bool> SaveTemps("save-temps", cl::desc("Save temp files"),
cl::init(false));
static cl::opt<unsigned>
NumShuffles("num-shuffles",
cl::desc("Number of times to shuffle and verify use-lists"),
cl::init(1));
namespace {
struct TempFile {
@ -370,13 +375,19 @@ int main(int argc, char **argv) {
return 0;
}
shuffleUseLists(*M);
if (!verifyBitcodeUseListOrder(*M))
report_fatal_error("bitcode use-list order changed");
for (unsigned I = 0, E = NumShuffles; I != E; ++I) {
DEBUG(dbgs() << "*** iteration: " << I << " ***\n");
if (shouldPreserveAssemblyUseListOrder())
if (!verifyAssemblyUseListOrder(*M))
report_fatal_error("assembly use-list order changed");
// 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.
shuffleUseLists(*M, I);
if (!verifyBitcodeUseListOrder(*M))
report_fatal_error("bitcode use-list order changed");
if (shouldPreserveAssemblyUseListOrder())
if (!verifyAssemblyUseListOrder(*M))
report_fatal_error("assembly use-list order changed");
}
return 0;
}