-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[LICMPass] Runtime issues caused by LICMpass optimization #68776
Comments
IR informations obtained through '-opt-bisect-limit' option: |
Infinite loops without side effects are undefined behavior in C. Use |
after add option '-fno-finite-loops' ,the result is: And if I changed the case to this: commands changed to :clang -O2 test-code2.c && ./a.out 1 VS clang -O0 test-code2.c && ./a.out 1 In this case , it dose not satisfy the infinit loops. |
Sorry, I didn't look carefully enough at your example. The issue is even more severe, because you are reading a non-atomic variable from a signal handler. |
Yes, so in LICM, promoteLoopAccessesToScalars function should consider the non-atomic variable readed from a signal handler. |
@XingYuShuai No, your code is not well-defined. You can only read lock-free atomic or volatile sig_atomic_t from a signal handler. |
|
being mentioned outside the loop in some cases. Please refer to issue:68776 for details. Fixes llvm#68776 Fixes llvm#69279
@nikic If you mean the Run_Index is volatile or atomic, in these cases, there is no problem with open source version. |
case:
test-code.txt
Commands:clang -O2 test-code.c && ./a.out 10 VS clang -O0 test-code.c && ./a.out 10
result:
The text was updated successfully, but these errors were encountered: