[LLVMdev] What does LLVM ERROR: Cannot select.. mean?

Roman Kennke rkennke at redhat.com
Tue Dec 4 10:59:16 PST 2012

Am Montag, den 03.12.2012, 17:40 -0600 schrieb Krzysztof Parzyszek:
> On 12/3/2012 5:07 PM, Roman Kennke wrote:
> > Hello,
> >
> > I am currently working on Shark, a backend for the Hotspot VM of
> > OpenJDK, which uses LLVM to generate target machine code.
> >
> > I am currently running into an LLVM error message, and I don't know
> > exactly what it means or what I am doing wrong:
> The instruction selection cannot find a way to convert this into machine 
> instructions.  Most likely there is no pattern to match this part of the 
> graph in your .td file.
> You can see what's going on during selection with -mllvm 
> -debug-only=isel.  The dumps are somewhat cumbersome to read, but not 
> hard overall.

Thanks for the information. I found out that this is because of this
little restriction for atomic load/store:

"The type of the pointee must be an integer type whose bit width is a
power of two greater than or equal to eight and less than or equal to a
target-specific size limit"

I did atomic store/loads without conversion and this lead to the LLVM
ERROR that I originally posted. Issuing a bitcast after the load and
before the store resolved it.

Another little (potential) issue relating to the above restriction: how
can I find out (programmatically) what is the "target-specific size
limit" ? In particular, I am worried about some platforms not supporting
64bit atomics. Any ideas? I'd like to avoid tons of #ifdef PLATFORM
specific code if possible.

Best regards,

More information about the llvm-dev mailing list