[LLVMdev] warning from -instcombine

Török Edwin edwintorok at gmail.com
Fri Feb 27 12:29:40 PST 2009


On 2009-02-27 22:20, Jay Foad wrote:
>> How about setting an error flag, and error message in the Module, then
>> let the caller know the Module is broken?
>>     
>
> I'm not sure what you mean by "broken". In the case of this "arguments
> were dropped" warning, the module just contains some code that will
> give undefined behaviour if it gets executed. It would be reasonable
> for an optimiser to turn that code into a call to abort(). 

Sorry, if it is just a warning, then the module is not broken.

Maybe module can have a list of warnings, and the caller can check it.
Ideally these would be set by diagnostic passes.
llvm-gcc might print a warning, opt may continue to use cerr, etc.

I don't like warnings depending on optimizations being run, but if the
only way to catch this one
is by running instcombine, I think there is no other way.
If this warning could be caught by running an independent diagnostics
pass (LLVM doesn't have any currently),
then maybe this functionality should be moved into a pass of its own?

What do you think?

> In the
> static compilation case it would also be reasonable to warn the user;
> it's just that dumping this message to cerr is a very crude way of
> doing that, compared to the sort of warnings that a user would expect
> to see from a GCC-like compiler.
>   

Indeed.

Best regards,
--Edwin



More information about the llvm-dev mailing list