Skip to content
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

clang never finishes on one particular C++ file #57164

Open
yurivict opened this issue Aug 15, 2022 · 7 comments
Open

clang never finishes on one particular C++ file #57164

yurivict opened this issue Aug 15, 2022 · 7 comments
Labels

Comments

@yurivict
Copy link

yurivict commented Aug 15, 2022

unity_1935_cxx.cxx.E.cxx.bz2

FreeBSD bug report.

@yurivict yurivict changed the title ang never finishes on one particular C++ file clang never finishes on one particular C++ file Aug 15, 2022
@EugeneZelenko EugeneZelenko added clang Clang issues not falling into any other category and removed new issue labels Aug 15, 2022
@VoxSciurorum
Copy link

To reproduce feed the attached file to llc. It hangs in DAGCombiner::Run. If you run the LLVM 14

clang++ -fno-strict-aliasing -fno-omit-frame-pointer -march=native -O3 -fPIC -emit-llvm

on the original file you get an IR file that causes llc to hang. From there I narrowed down the crash by dumping after each pass. The file is from the last pass that didn't hang.

You need the clang++ from LLVM 14 because the builtins changed in LLVM 15. Both 14 and 15 llc hang.

Target is amd64.

bad-llc-ir.txt

@EugeneZelenko EugeneZelenko added llvm:codegen llvm:hang Compiler hang (infinite loop) and removed clang Clang issues not falling into any other category labels Aug 15, 2022
@xgupta
Copy link
Contributor

xgupta commented Apr 18, 2023

Not reproduce with the current trunk - https://godbolt.org/z/PzdPdvrcz..

@yurivict
Copy link
Author

@xgupta
Are you trying on FreeBSD?

@xgupta
Copy link
Contributor

xgupta commented Apr 18, 2023

No it is Linux system.

@yurivict
Copy link
Author

C++ bugs like this likely depend on the C++ library that is used, which is different on FreeBSD.

@VoxSciurorum
Copy link

Not reproduce with the current trunk - https://godbolt.org/z/PzdPdvrcz..

Run llc on the IR file I attached. llc hangs at -O1, -O2, or with default optimization. llc completes in a second or two at -O0. Verified on FreeBSD/amd64, FreeBSD/arm64, and Linux/amd64. Apparently at all versions from 14 up to latest trunk.

I forgot to include a target triple in the IR file. It would have been generated on FreeBSD/amd64.

This is not a FreeBSD-specific bug. It is a codegen bug that happens to be triggered by libraries and headers on a FreeBSD system.

@VoxSciurorum
Copy link

It is worth mentioning that the IR file contains a basic block with about 43,000 instructions and 40,000 values. The "hang" may in fact be a superlinear run time. Whatever optimization it is attempting should be disabled when the block size is so large.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants