[PATCH] D33265: [PredicateInfo ] Fix non-determinism in codegen uncovered by reverse iterating SmallPtrSet

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 10:52:50 PDT 2017


mgrang added a comment.

Thanks @davide and @dberlin for your comments.

Just wanted to confirm I understand this: In order to reuse the comparison function from ValueDFS_Compare in our case, we would have to move the localComesBefore function (or parts of it) out of ValueDFS_Compare so that both OBBMap and OpsToRename can use it as a comparator? ValueDFS_Compare constructor accepts BBs, so unless we first convert OpsToRename into ValueDFS (by calling our version of convertUsesToDFSOrdered) we cannot directly use it for sorting OpsToRename.
Or would it be simpler to just keep the comparator inline as you do in your code?

Also is it OK to add -reverse-iterate to the two unit tests as I have done in my patch (so that we catch any future non-determinism arising out of this piece of code)?


https://reviews.llvm.org/D33265





More information about the llvm-commits mailing list