there aren't a lot of good ways to express a portable overflow check for a multiply in conformant C. here's one way that people do it:
a > (UINT_MAX /u b)
this patch teaches instcombine to turn this back into a umul.with.overflow
@sanjoy, you dealt with this sort of canonicalization before. What are your thoughts? Would we want this is InstCombine or CGP? umul_with_overflow may be more canonical because it can be speculated...
This might not be a canonical transform if the division has multiple users.
The conclusions / guidelines decided from the earlier work were
@regehr is there some specific reason it helps to canonicalize like this?
Hi guys, I don't know the best place for this-- just wanted to implement it since Rich Felker, author of Musl libc, was complaining that the transformation is missing. If this isn't the right place I'm happy to close this out.