[PATCH] D133198: [SCCP] convert signed div/rem to unsigned for non-negative operands

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 6 13:49:25 PDT 2022


spatel added a comment.

In D133198#3772527 <https://reviews.llvm.org/D133198#3772527>, @fhahn wrote:

> I should have been clearer, this patch seems to cause the assertion below for the reproducer:
>
>   Assertion failed: (I != ValueState.end() && "V not found in ValueState nor Paramstate map!"), function getLatticeValueFor, file SCCPSolver.cpp, line 418.
>   PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
>   Stack dump:
>   0. Program arguments: ..../bin/opt -ipsccp bugpoint-reduced-simplified.ll
>   Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
>   0  opt                      0x0000000106285094 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
>   1  opt                      0x0000000106284094 llvm::sys::RunSignalHandlers() + 112
>   2  opt                      0x0000000106285720 SignalHandler(int) + 344
>   3  libsystem_platform.dylib 0x0000000197bc82a4 _sigtramp + 56
>   4  libsystem_pthread.dylib  0x0000000197b99cec pthread_kill + 288
>   5  libsystem_c.dylib        0x0000000197ad32c8 abort + 180
>   6  libsystem_c.dylib        0x0000000197ad2620 err + 0
>   7  opt                      0x00000001072a5cac llvm::SCCPInstVisitor::getLatticeValueFor(llvm::Value*) const (.cold.3) + 0
>   8  opt                      0x00000001063883ec llvm::SCCPSolver::getTrackedRetVals() + 0

Thanks for reverting. I didn't see any bot fail mails that correspond to this crash, but I can repro the minimal test crashing locally.
However, I'm still not sure what is going on in the internals of the solver. Strangely, there's no crash if I just insert the same test into the file with the other tests that were added for this patch. Something about the state of other tests prevents the crash.
Maybe this is why the existing code avoided transforming a constant-foldable instruction in the sext case? :)
If I add a clause like that here, it seems to avoid the trouble, but I'll try to step through some more and see if I can find the real cause of the problem.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133198



More information about the llvm-commits mailing list