[PATCH] D28853: [SelectionDAG] Improve knownbits handling of UMIN/UMAX (PR31293)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 14:43:21 PST 2017

RKSimon added a comment.

Thanks Matt

Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2712-2715
+    // UMAX - we know that the result will have the maximum of the
+    // known one leading bits of the inputs.
+    unsigned LeadOne = KnownOne.countLeadingOnes();
+    LeadOne = std::max(LeadOne, KnownOne2.countLeadingOnes());
arsenm wrote:
> Should it also be the minimum of the known leading 0s?
If one input is 0xFFFFxxxx and the other is 0xFxxxxxxx then we know that the UMAX result is at least 0xFFFF0000.



More information about the llvm-commits mailing list