[llvm] r214144 - llvm-uselistorder: Add -num-shuffles option

Sean Silva chisophugis at gmail.com
Tue Jul 29 09:43:34 PDT 2014


Some random comments:

1. Looks like the comment at the top of the file is copypasta from opt.

2. The comment at the top of this file should describe the purpose of this
tool. From skimming the code it looks like some sort of fuzzer.

3. The name is incredibly ambiguous; could it at least have a verb in it?
It seems like it is a fuzzer that verifies that use-lists correctly
round-trip through bitcode. Is there a better name? Maybe something with
"verify" in it? (a long-ish name for a specialized tool like this wouldn't
seem that out of place).

-- Sean Silva


On Mon, Jul 28, 2014 at 5:25 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

> 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;
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140729/01b24b45/attachment.html>


More information about the llvm-commits mailing list