diff options
author | Mandeep Singh Grang <mgrang@codeaurora.org> | 2016-12-14 00:15:57 +0000 |
---|---|---|
committer | Mandeep Singh Grang <mgrang@codeaurora.org> | 2016-12-14 00:15:57 +0000 |
commit | f6b069c7db5f86e73d997b212da8dfa5c32b822f (patch) | |
tree | d3472a6f8733ec93d980671e1ab7d68ccf16e801 /llvm/lib/Support/CommandLine.cpp | |
parent | 30e304e2a646ccd5f34d5697cad0be9dcccfaa2d (diff) | |
download | bcm5719-llvm-f6b069c7db5f86e73d997b212da8dfa5c32b822f.tar.gz bcm5719-llvm-f6b069c7db5f86e73d997b212da8dfa5c32b822f.zip |
[llvm] Iterate SmallPtrSet in reverse order to uncover non-determinism in codegen
Summary:
Given a flag (-mllvm -reverse-iterate) this patch will enable iteration of SmallPtrSet in reverse order.
The idea is to compile the same source with and without this flag and expect the code to not change.
If there is a difference in codegen then it would mean that the codegen is sensitive to the iteration order of SmallPtrSet.
This is enabled only with LLVM_ENABLE_ABI_BREAKING_CHECKS.
Reviewers: chandlerc, dexonsmith, mehdi_amini
Subscribers: mgorny, emaste, llvm-commits
Differential Revision: https://reviews.llvm.org/D26718
llvm-svn: 289619
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index c9751c093d6..f4d501aceba 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -45,6 +45,17 @@ using namespace cl; #define DEBUG_TYPE "commandline" +#if LLVM_ENABLE_ABI_BREAKING_CHECKS +namespace llvm { +// If LLVM_ENABLE_ABI_BREAKING_CHECKS is set the flag -mllvm -reverse-iterate +// can be used to toggle forward/reverse iteration of unordered containers. +// This will help uncover differences in codegen caused due to undefined +// iteration order. +static cl::opt<bool, true> ReverseIteration("reverse-iterate", + cl::location(ReverseIterate<bool>::value), cl::init(true)); +} +#endif + //===----------------------------------------------------------------------===// // Template instantiations and anchors. // |