[llvm] r302566 - [NewGVN] Explain why sorting by pointer values doesn't introduce non-determinism.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Tue May 9 11:29:38 PDT 2017
Author: davide
Date: Tue May 9 13:29:37 2017
New Revision: 302566
URL: http://llvm.org/viewvc/llvm-project?rev=302566&view=rev
Log:
[NewGVN] Explain why sorting by pointer values doesn't introduce non-determinism.
Thanks to Eli for pointing out in a post-commit review comment.
Modified:
llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp?rev=302566&r1=302565&r2=302566&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Tue May 9 13:29:37 2017
@@ -734,6 +734,10 @@ PHIExpression *NewGVN::createPHIExpressi
// 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);
More information about the llvm-commits
mailing list