Open stellarpower opened 5 months ago
@llvm/issue-subscribers-backend-x86
Author: None (stellarpower)
What's interesting is I have tried cleaning and explicitly turning off using
-mno-sse4.2
as wel las explicitly enabling using-msse4.2
. The processor I am building on is recent and should support these so I'm not sure why it's unable to output those instructions.
Why do you want to turn off SSE4.2?
CRC32 has a separate enable control from -msse4.2 too. -mcrc32 and -mno-crc32. Clang is supposed to enable it with -msse4.2 (or a SSE4.2 cpu) as long as -mno-crc32 is not specified.
I wonder if somehow the "crc32" feature is not set for that function when the IR reaches the backend, but I'm not sure how that would happen.
What's interesting is I have tried cleaning and explicitly turning off using
-mno-sse4.2
as wel las explicitly enabling using-msse4.2
. The processor I am building on is recent and should support these so I'm not sure why it's unable to output those instructions.Why do you want to turn off SSE4.2?
I don't in general, it was just in an effort to try and avoid this error. I'll try the crc32 flags as topper mentions and see what happens. The original build seems to be using link-time optimisation, so I don't know if that has anything to do with the issue. The dependencies in general will have been built using different flags to the main project, although obviously this probably shouldn't cause an internal crash.
It's normal to see internal crash when using target specific intrinsics but lacking related features in LLVM IR. But the FE should have checked for all the cases, and error out it early. I don't see any problem with these crc32 intrinsic definations in the FE, so it's still a mystery how the IR being generated.
Agreed, why it can't select them is possibly due to the specifics of this big heap of Unix makefiles used to generate the project, but, it's probably best it doesn't crash internally, and also, if it is able to produce an error message, including diagnostic information about why the instruction couldn't be selected would probably also be useful and then if there is a problem in my setup, I can go and fix that. I also haven't pinned down the exact major version where this changed, but clang 10 builds it without a problem. Whilst I assume there will have obviously been pretty major backend changes since then, the crash is new in a sense at least.
It may be affected by https://github.com/llvm/llvm-project/commit/12fa608af44a80de8b655a8a984cd095908e7e80, which included since LLVM14, if it was good in an earlier version. But I cannot tell what's wrong without a reasonable reproducer. It would be helpful if you can provide a small reproducer.
Seems the same as #15319, although this is occurring "in the wild".
I'm trying to build a large application project (original sources here, but modified since then), so, I'm not manually making use of the CRC functions (it's coming out of ZLib, although previously saw it coming out of Qt somehow), and I expect it would take quite some work to cut it back into an MRE unless someone else has an idea of what the issue might be.
What's interesting is I have tried cleaning and explicitly turning off using
-mno-sse4.2
as wel las explicitly enabling using-msse4.2
. The processor I am building on is recent and should support these so I'm not sure why it's unable to output those instructions.Can try to provide more information, but as mentioned - not sure what would be the most helpful given the size of the project - the build is all spread across tonnes of makefiles with the flags hardcoded, so very hard to follow what options are really being used when.
My application builds using Clang 10 in the Ubuntu repositories; I had upgraded using the PPA to get better C++20 support. I see the same issue with Clang versions 18 and 19; not yet tested any others.