[PATCH] D149423: [ValueTracking] Use knownbits interface for determining if `div`/`rem` are safe to speculate

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 16:02:35 PDT 2023


goldstein.w.n added a comment.

In D149423#4330861 <https://reviews.llvm.org/D149423#4330861>, @alexfh wrote:

> This patch is causing a miscompile:
>
>   $ cat q.cc 
>   extern unsigned q();
>   int main() {
>     unsigned qq = q();
>     if (qq == 0) qq = 1;
>     int rows = 8192 / qq;
>     if (rows == 0) rows = 1;
>     return rows;
>   }
>   $ cat w.cc
>   unsigned q() { return 524288; }
>   $ clang -fsanitize=memory -O2 q.cc w.cc && ./a.out
>   MemorySanitizer:DEADLYSIGNAL
>   ==885020==ERROR: MemorySanitizer: FPE on unknown address 0x0000002cc0c4 (pc 0x0000002cc0c4 bp 0x000000000001 sp 0x7ffd25df6e50 T885020)
>   ...
>
> Please revert or fix soon. Thanks!

Reverting, wasn't able to track down the issue. I think this showing another bug
elsewhere but will revert while I investigate.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149423



More information about the llvm-commits mailing list