[PATCH] D11345: ignore duplicate divisor uses when transforming into reciprocal multiplies (PR24141)
Eric Christopher
echristo at gmail.com
Mon Jul 20 13:04:01 PDT 2015
echristo added a subscriber: echristo.
echristo added a comment.
One inline comment/question. Otherwise it looks OK to me, but I don't do much in here a lot.
-eric
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:8372-8374
@@ -8371,3 +8371,5 @@
for (auto *U : N1->uses()) {
- if (U->getOpcode() == ISD::FDIV && U->getOperand(1) == N1)
- Users.push_back(U);
+ if (U->getOpcode() == ISD::FDIV && U->getOperand(1) == N1) {
+ // Only count unique users; duplicates may be present in the list.
+ if (std::find(Users.begin(), Users.end(), U) == Users.end())
+ Users.push_back(U);
----------------
Could probably merge it into the existing if statement?
That said, I guess using std::find on it is how we do it for most of these, I assume we don't expect a lot of users and so would want to use a different mechanism?
http://reviews.llvm.org/D11345
More information about the llvm-commits
mailing list