[LLVMdev] Problem with code generated for call using stdcall convention
baldrick at free.fr
Thu Dec 10 02:07:10 PST 2009
> Wouldn't it be a good idea to add a check for this to the function
> verifier pass?
no, because it is valid. The problem is that the optimizers can expose
this kind of thing. For example, imagine you have an indirect call, where
the calling convention is CC_X. Suppose the optimizers are able to deduce
the function that is being called, say F, and turn the call into a direct
call to F. If the calling convention for F is different, say CC_Y, then
having the verifier reject the bitcode because CC_X != CC_Y would result
in a compiler crash. So you would have to teach all kind of optimizers
to be careful because they might turn a valid program into an invalid one.
That's too painful.
More information about the llvm-dev