[PATCH] D45858: [DivRemPairs] Fix non-determinism in use list order.

Geoff Berry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 10:46:54 PDT 2018


gberry added a comment.

In https://reviews.llvm.org/D45858#1073565, @spatel wrote:

> That looks ok, but I'm curious;
>
> 1. How do you discover this problem?


I ran into this when testing a totally unrelated change that I expected to have no effect on final code generation.  When it generated different code for one llvm-test-suite test case, I investigated why, and it led me here.

> 2. Is it possible to make the problem visible in a regression test (if so, please add a test)?

I don't think so, but maybe.  The problem is that before this change, the DivRemPairs pass will generate non-deterministic use-list orderings.  I could write a test that dumps the use-list info and check that, but that seems pretty fragile.

> 3. The DenseMap usage is based on the code in BypassSlowDivision - does it have the same problem/fix?

I looked over BypassSlowDivision briefly and it doesn't seem to have the same problem.  The only iteration over an unordered container seems to be at the end of bypassSlowDivision where it is iterating over PerBBDivCache.  This loop is only removing dead instructions so I don't think the removal order should have any effect on the IR use-list order.


Repository:
  rL LLVM

https://reviews.llvm.org/D45858





More information about the llvm-commits mailing list