-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Wrong code at -Os on x86-64_gnu-linux (recent regression) #82243
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
Labels
Comments
The issue is that IndVars doesn't drop poison-generating flags when hoisting the IV to introduce a new use of the widened IV. working on a fix |
fhahn
added a commit
to fhahn/llvm-project
that referenced
this issue
Feb 20, 2024
widenIVUse may hoist a wide induction increment and introduce new uses, but does not recompute the wrap flags. In some cases this can make the new uses of the wide IV inc more poisonous. Update the code to recompute flags if needed when hoisting an IV. If both the narrow and wide IV increment's flags match and we can re-use the flags from the increments, there's no need to recompute the flags, as the replacement won't make the new uses of the wide IV's increment more poisonous. Note that this also updates a stale comment which claimed that the widen increment is only used if it dominates the new use. Happy to move out introducing canReuseFlagsFromOriginalIVInc to a separate patch if desired and once we agree on the API. The helper should also be used to guard the code added in da43733, which I am planning on doing separately once the helper lands. Fixes llvm#82243.
fhahn
added a commit
that referenced
this issue
Feb 20, 2024
…82352) widenIVUse may hoist a wide induction increment and introduce new uses, but does not recompute the wrap flags. In some cases this can make the new uses of the wide IV inc more poisonous. Update the code to recompute flags if needed when hoisting an IV. If both the narrow and wide IV increment's flags match and we can re-use the flags from the increments, there's no need to recompute the flags, as the replacement won't make the new uses of the wide IV's increment more poisonous. Note that this also updates a stale comment which claimed that the widen increment is only used if it dominates the new use. The helper should also be used to guard the code added in da43733, which I am planning on doing separately once the helper lands. Fixes #82243.
Should be fixed, thanks again as always @shao-hua-li |
You're welcome @fhahn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Clang at -Os produced the wrong code.
Bisected to dce77a3, which was committed by @fhahn
Compiler explorer: https://godbolt.org/z/fTrenPK4h
The text was updated successfully, but these errors were encountered: