diff options
author | Davide Italiano <davide@freebsd.org> | 2017-05-09 18:29:37 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2017-05-09 18:29:37 +0000 |
commit | 63998ec3c86eb090ac1a3086ba22784392b15b94 (patch) | |
tree | 83d0b75c0635931014b57c848de2fa0ca6f9a15f /llvm/lib/Transforms | |
parent | d94e6d9ac1ef095f36cca2b31aa927910149ff0f (diff) | |
download | bcm5719-llvm-63998ec3c86eb090ac1a3086ba22784392b15b94.tar.gz bcm5719-llvm-63998ec3c86eb090ac1a3086ba22784392b15b94.zip |
[NewGVN] Explain why sorting by pointer values doesn't introduce non-determinism.
Thanks to Eli for pointing out in a post-commit review comment.
llvm-svn: 302566
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/NewGVN.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index c7afd1d80ed..e976f0ec8c3 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -734,6 +734,10 @@ PHIExpression *NewGVN::createPHIExpression(Instruction *I, bool &HasBackedge, // PHIs. LLVM doesn't seem to always guarantee this. While we need to fix // this in LLVM at some point we don't want GVN to find wrong congruences. // Therefore, here we sort uses in predecessor order. + // We're sorting the values by pointer. In theory this might be cause of + // non-determinism, but here we don't rely on the ordering for anything + // significant, e.g. we don't create new instructions based on it so we're + // fine. SmallVector<const Use *, 4> PHIOperands; for (const Use &U : PN->operands()) PHIOperands.push_back(&U); |