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
Infinite loop at -O2 and -Os #48885
Comments
Double-check my understanding: |
I'm pretty sure that this is an actual infinite loop in -simplifycfg, but let me know if I'm not seeing this correctly. define void @#49541 (i32* %t1, i32 %a, i1 %bool) { j: i: cond.true: cond.false: This will inf-loop with: |
Hi Sanjay! Thanks for your checking! I think it's my fault that I have misunderstood something here. So I changed the title to "Infinite loop at -O2 and -Os". By the way, can you also help check bug 49206? I think it's an infinite loop issue as well and still exists in the current trunk and last released versions. Thanks again for your quick and nice checking! Cheers, |
Here's a minimal fix for trunk: I'm going to mark this as blocking the 12.0 release, but it might be too late to get included. |
*** Bug llvm/llvm-bugzilla-archive#49556 has been marked as a duplicate of this bug. *** |
This is a regression that occurred between clang 6.0.0 and clang 7.0.0. Would a bisect help? |
AFAIK, the bug is fixed in trunk, and it's still potentially going to make the 12.0 release. But I doubt anyone is going to patch anything older than that? Not sure if that was the question though. :) |
No, I was saying that this code worked in clang 6 and below. I was asking if a bisect for the cause of the regression would help with the fix. |
Merged: e94372d |
I did get around to bisecting this regression. It was caused by 66182d6c3805d167 Thanks for fixing it Sanjay. |
*** Bug llvm/llvm-bugzilla-archive#49206 has been marked as a duplicate of this bug. *** |
mentioned in issue llvm/llvm-bugzilla-archive#49556 |
Extended Description
Hi, all.
This code, small.c, is a valid program but makes Clang trunk hung on at compile time at -O2 and -Os. Note that this issue also occurs in recently released versions of clang, e.g., clang-10, clang-11.
$cat small.c
#include <stdint.h>
int a;
void b(int c) {
int32_t *d = a;
uint64_t e;
int8_t f = 4;
uint16_t g;
if (0)
j:
if (e <= (*d *= a))
goto j;
i:
if (c ? g %= f : *d)
goto i;
goto j;
}
$clang -O2 -w small.c (or -Os)
//endless compiling
$clang -v
clang version 13.0.0 (https://github.com/llvm/llvm-project 590ac0a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/haoxin-data/dut-research/compilers/llvm-project/build-20210310/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Candidate multilib: .;@m64
Selected multilib: .;@m64
Thanks,
Haoxin
The text was updated successfully, but these errors were encountered: