Bug in use-list order serialization


I want to ask if incorrect serialization of a constant's use-list order
is considered as a bug.

While compiling some programs with

clang -c -emit-llvm -O2 -g

I noticed that for many of the bitcode files the verify-uselistorder
tool terminates with output

*** verify-uselistorder ***
verify bitcode
LLVM ERROR: use-list order changed

where the mismatch is always for the constant i64 0. This happens both
with version 5.0.1 and 6.0 RC3 of LLVM and clang. I managed to trigger
this behavior with the following reduced test-case:

#include <stdio.h>
int main (int argc, char **argv) {
  struct M { char const *a; char const *b; } const map[] = {
    { "a", "b" },
    { NULL, NULL }
  char const *foo = "foo";
  struct M const *m = map;
  while (m->a)
  if (m->b)
    foo = m->b;
  printf("%s", foo);
  return 0;


Yes, this is a bug. Please file a PR, attach a .ll and/or .bc file, and CC me. Bonus points if you bugpoint reduce it first.