[llvm] r214144 - llvm-uselistorder: Add -num-shuffles option
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Jul 28 16:25:21 PDT 2014
Author: dexonsmith
Date: Mon Jul 28 18:25:21 2014
New Revision: 214144
URL: http://llvm.org/viewvc/llvm-project?rev=214144&view=rev
Log:
llvm-uselistorder: Add -num-shuffles option
Modified:
llvm/trunk/test/Bitcode/use-list-order.ll
llvm/trunk/tools/llvm-uselistorder/llvm-uselistorder.cpp
Modified: llvm/trunk/test/Bitcode/use-list-order.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/use-list-order.ll?rev=214144&r1=214143&r2=214144&view=diff
==============================================================================
--- llvm/trunk/test/Bitcode/use-list-order.ll (original)
+++ llvm/trunk/test/Bitcode/use-list-order.ll Mon Jul 28 18:25:21 2014
@@ -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)
Modified: llvm/trunk/tools/llvm-uselistorder/llvm-uselistorder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-uselistorder/llvm-uselistorder.cpp?rev=214144&r1=214143&r2=214144&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-uselistorder/llvm-uselistorder.cpp (original)
+++ llvm/trunk/tools/llvm-uselistorder/llvm-uselistorder.cpp Mon Jul 28 18:25:21 2014
@@ -43,6 +43,11 @@ static cl::opt<std::string> InputFilenam
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");
-
- if (shouldPreserveAssemblyUseListOrder())
- if (!verifyAssemblyUseListOrder(*M))
- report_fatal_error("assembly use-list order changed");
+ for (unsigned I = 0, E = NumShuffles; I != E; ++I) {
+ DEBUG(dbgs() << "*** iteration: " << I << " ***\n");
+
+ // 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;
}
More information about the llvm-commits
mailing list