[PATCH] D20225: SelectionDAG: Select min/max when both are used
James Molloy via llvm-commits
llvm-commits at lists.llvm.org
Fri May 13 01:15:17 PDT 2016
jmolloy accepted this revision.
jmolloy added a comment.
This revision is now accepted and ready to land.
Hi,
Generally looks fine as-is, but I think the helper can be simplified a bit.
James
================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:2702
@@ +2701,3 @@
+// selects with the same condition.
+bool hasMinMaxUses(const SelectInst &SI) {
+ const Value *C = SI.getCondition();
----------------
I think this can be written simpler. Is it important that we bail out for > 2 users? If we have > 2 users of an icmp that are both selects, surely one would have been CSEd before now?
So we could just do:
static bool hasOnlySelectUsers(Value *Cond) {
return std::all_of(Cond->user_begin(), Cond->user_end(), [](Value *V) {
return isa<SelectInst>(V);
});
}
?
http://reviews.llvm.org/D20225
More information about the llvm-commits
mailing list