New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLVM 14 regression: __muloti4 is lowered with a recursive call despite nobuiltin attribute #56403
Comments
@llvm/issue-subscribers-bug |
This is a workaround for llvm/llvm-project#56403
I bisected this issue down to 35fa7b8 - CC @LebedevRI. |
This is a workaround for llvm/llvm-project#56403
This is a workaround for llvm/llvm-project#56403
CC @rotateright who suggested this might be better in Aggressive InstCombine where we can put a better legality check on it |
I spent all day mucking around with AggressiveInstCombine, but then realized we can probably get away with a tiny patch to the existing code to avoid the bug: |
We're leaning towards a backend quick-fix instead of or possibly alongside the IR change: |
This is a potentially better alternative to D131452 that also should avoid the infinite loop bug from: issue #56403 This is again a minimal fix to reduce merging pain for the release. But if this makes sense, then we might want to guard all of the RTLIB generation (and other libcalls?) with a similar name check. Differential Revision: https://reviews.llvm.org/D131521
/branch llvm/llvm-project-release-prs/issue56403 |
/pull-request llvm/llvm-project-release-prs#114 |
This is a potentially better alternative to D131452 that also should avoid the infinite loop bug from: issue #56403 This is again a minimal fix to reduce merging pain for the release. But if this makes sense, then we might want to guard all of the RTLIB generation (and other libcalls?) with a similar name check. Differential Revision: https://reviews.llvm.org/D131521 (cherry picked from commit 7f72a0f)
This is a regression from 13.0.1 to 14.0.6. The reproduction I have here is for aarch64-linux, however, I can also reproduce it for wasm32-wasi.
To help provide an overview of the IR, here is the high level source code:
Input LLVM IR:
Note that the
__muloti4
function has thenobuiltin
attribute. After optimizations are applied, the IR transforms to:Note in particular the call to
@llvm.smul.with.overflow.i128
. This will lower to a call to__muloti4
itself, causing an infinite loop. In LLVM 13.0.1, this instead optimized to amul
instruction, avoiding the problem.If this is all working as designed, then can I please be advised - how is this use case intended to be solved? As far as I can tell, LLVM's own compiler-rt is just getting "lucky" that this is not happening to its
__muloti4
symbol, since its implementation is slightly more convoluted.The text was updated successfully, but these errors were encountered: