-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
attempt to define llvm intrinsic not rejected by verifier #1419
Comments
assigned to @lattner |
The reason that you get the: warnings is because you are relying undefined behavior. In vprintf you cast __stdio_outs to take three LLVM "devirtualizes" the function pointer, turning it into a direct call, at which point it sees that you're However, there is still an llvm bug. I'm investigating. -Chris |
The bug is in your code. This is not valid LLVM: void %llvm.memcpy.i32(sbyte*, sbyte*, uint, uint) { You've turned memcpy and others into a noop. I will make the verifier reject this. What are you trying to |
Fixed, patch here: Testcase here: -Chris |
My purpose for defining intrinsics is to eliminate all declares from the final linked bytecode. |
another solution is to handle intrinsics like llvm.mempcy.* as calls to memcpy. -Chris |
Yes, after some discussion we decided to do it that way. |
I have made the two changes you mentioned. However, the problem still exists.
Am I still doing something stupid? I uploaded llvm-bug2.zip (see bug URL) so you can see it for yourself. |
Ok, I just talked to nicholas, and he realized that the string literal is being accessed directly in printf() So, I was chasing a red haring. Sorry!! I set the bug back to fixed. |
This should fix the problem reported by the lld buildbots: - Builder lld-x86_64-darwin13, Build llvm#19782 - Builder lld-perf-testsuite, Build llvm#1419 llvm-svn: 329068
Extended Description
To reproduce the bug:
you will see the diff of hello1.ll and hello2.ll
hello1.c and hello2.c are similar hello world examples using our custom libc
the makefile should compile them without using the default system libraries
notice that the string literal "Hello World!\n" is not an argument to printf in hello1.
instead, int 0 is the only argument.
it looks like it has been optimized to nothing.
rather than being a bug in my library, i believe this is an optimizer problem, because you can edit the
Makefile, removing the -O3 optimization argument, and the problem seems to disappear.
this is my first bugzilla report, pardon me if my n00bness is apparent! :P
thanks!
The text was updated successfully, but these errors were encountered: