ignore duplicate divisor uses when transforming into reciprocal multiplies (PR24141)
authorSanjay Patel <spatel@rotateright.com>
Tue, 28 Jul 2015 23:28:22 +0000 (23:28 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 28 Jul 2015 23:28:22 +0000 (23:28 +0000)
commit8fd3ed9e3a3ee5d78c871c0e0d961bf21e5d1b71
treea8b9322a7a8619a743e84113088108ca21bc1f3c
parent6ea347b66fd299bdcc62d8917aa8ef490c34a344
ignore duplicate divisor uses when transforming into reciprocal multiplies (PR24141)

PR24141: https://llvm.org/bugs/show_bug.cgi?id=24141
contains a test case where we have duplicate entries in a node's uses() list.

After r241826, we use CombineTo() to delete dead nodes when combining the uses into
reciprocal multiplies, but this fails if we encounter the just-deleted node again in
the list.

The solution in this patch is to not add duplicate entries to the list of users that
we will subsequently iterate over. For the test case, this avoids triggering the
combine divisors logic entirely because there really is only one user of the divisor.

Differential Revision: http://reviews.llvm.org/D11345

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243500 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/fdiv-combine.ll