[PATCH] D140636: [Support] Fix what I think is an off by 1 bug in UnsignedDivisionByConstantInfo.

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 24 15:31:22 PST 2022


barannikov88 added a comment.

In D140636#4016138 <https://reviews.llvm.org/D140636#4016138>, @craig.topper wrote:

> I think what happened is that I checked by writing the code in C and InstCombine has a replacement for udiv with a divisor that large. So I didn't test udiv for that value.

Yeah, that's probably the reason the bug hasn't been reported yet (I found this case by directly calling the function from a simple GTest).
It won't assert with APInt(8, 0x80) on a C code either, since division by a power of two is optimized into a shift.
We probably just need a targeted test in llvm/unittests/Support


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140636/new/

https://reviews.llvm.org/D140636



More information about the llvm-commits mailing list