[LLVMdev] aborting on invalid code

Chris Lattner clattner at apple.com
Mon Oct 13 10:42:32 PDT 2008


On Oct 13, 2008, at 10:05 AM, Dan Gohman wrote:

> On Sat, October 11, 2008 3:13 pm, Chris Lattner wrote:
>> [...]  Sending invalid
>> code into the backend is violating a very important invariant in the
>> API.  I don't see how it would be any different then passing in a  
>> null
>> pointer or garbage pointer into an API that would then bus error.
>
> Besides invalid IR, codegen also uses abort and assert when it
> encounters valid and Verifier-clean IR that uses features that
> codegen does not suport, due to missing functionality (e.g. i1024)
> or due to target-specific limitations (e.g. x86_f80 on non-x86
> targets).

There are also some cases with inline asm that do the same thing.

> Currently there no way to recover if the IR contains some
> construct that codegen can't handle. This is unfortunate for some
> applications.

I completely agree, but these should not be fixed with exceptions:  
this should be fixed by adding a direct failure reporting mechanism.

-Chris



More information about the llvm-dev mailing list