The combine added in commit 329525 overlooked the case where
one, but not all, of the divisor elements is -1.
-1 is the only power of two value for which the sdiv expansion recipe
breaks.
Fixes pr37119
Differential D45806
DAGcombiner: Handle correctly non-splat power of 2 -1 divisor RKSimon on Apr 19 2018, 1:26 AM. Authored by
Details The combine added in commit 329525 overlooked the case where Fixes pr37119
Diff Detail
Event Timeline
Comment Actions Refactored the patch to blend the special case values in at the end of the pow2 calculations. I'll add the SignedMin case in a followup but I wanted to keep this patch focussed on the -1 divisor case. Comment Actions Sorry for not being responsive. Won't have time to work on this, so thanks @RKSimon for taking charge.
Comment Actions I think you can save a blend by emitting one select for both "1" and "-1"? (SDValue IsOneOrAllOnes = DAG.getNode(ISD::OR, VT, IsAllOnes, IsOne); etc.) |
Not really relevant to this review, but I think KnownNegatives is dead.