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)
commit133e68b45cea9fa52c9a519bf287c6eea8ed5bba
tree76cf6d7c85229f6eb2891fccbf0c061896302d82
parent99a47ef90edb97b15becd553b1c9c5d76b9da376
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

llvm-svn: 243500
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/fdiv-combine.ll