[llvm-dev] what can cause a "CPU table is not sorted" assertion

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 15 18:23:24 PDT 2015


On 15 October 2015 at 15:49, Rail Shafigulin via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> No issues compiling the code. But when I run the following command I get and
> assertion:
>
> llc -mcpu=mytarget hello_world.compiled.ll -debug-only=misched
> -mtriple=mytarget-unknown-linux-gnu

Now that's weird. That list should be sorted automatically (by
utils/TableGen/SubtargetEmitter.cpp:227). And the sort seems to date
from 2005 so it's not even as if you could be using an out-of-date
llvm-tblgen by mistake.

The table should come from
$BUILD_DIR/lib/Target/MyTarget/MyTargetGenSubtargetInfo.inc. A table
named something like MyTargetSubTypeKV, I believe. I suggest you check
a few things, in roughly this order and with the help of a debugger:

  + That table really is sorted properly by the first string.
  + That is the table being used by LLVM just before the assert.
  + WTF is going on that the strcmp doesn't realise it's sorted.

I've got a very vague bet on locale, but even I can't see how that
could work. Knowing the strings that compare in an unexpected way
would certainly help though.

Cheers.

Tim.


More information about the llvm-dev mailing list