-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
wrong code (bad esp update) with -enable-llvm on x86 #1770
Comments
Does code generated with -disable-fp-elim fail too? |
Yes, it still fails with -disable-fp-elim. In fact |
The reason -disable-fp-elim has no particular effect is that the function |
From X86RegisterInfo.cpp:956:
With -enable-eh, CalleeAmt is 0; without it CalleeAmt is 4. |
Hrm, this is pretty strange... I'll have a look. |
It may come from here: // If the first argument is an sret pointer, remember it. Whether isSRet is true or not results in a 4 byte difference |
The invoke which gets the wrong stack pop amount after it, is invoke void @ol__normalize_pathname__get_directory.180 which is indeed a struct return. |
Well, if case of struct return callee should pop hidden pointer from stack. So, |
Exactly: with 12 it works, with 16 it dies horribly. |
Investigating |
Solution proposed by aKor on IRC: (09:32:17 PM) aKor[off-site]: in SelectionDAGLowering::LowerCallTo |
Extended Description
I've been seeing mysterious segfaults when compiling using
-enable-llvm, even though no exceptions are raised. It turns
out to be due to a wrong stack pointer update:
$ llc ol.bc -o no_eh
$ llc ol.bc -enable-eh -o eh
$ diff no_eh eh
...
144c153,155
< addl $12, %esp
If I change the $16 to $12 in the eh .s, then
the segfault goes away and all is well.
The text was updated successfully, but these errors were encountered: