Issue 148805
Summary Provide user friendly error message for `Function Import: link error: linking module flags 'ProfileSummary': IDs have conflicting values`
Labels lld, PGO, LTO
Assignees
Reporter zmodem
    This error occurs when linking LLVM modules with different profile data. Example:

```
$ cat /tmp/a.c
extern int bar(int argc);
int main(int argc, char **argv) {
  return bar(argc);
}

$ cat /tmp/b.c
int bar(int n) {
  if (n == 1) {
    return 0;
  } else if (n % 2 == 1) {
    return bar(3 * n + 1);
  }
  return bar(n / 2);
}

$ rm -f *.profraw *.profdata
$ build/bin/clang -O2 -fprofile-generate /tmp/a.c /tmp/b.c

$ LLVM_PROFILE_FILE=a.profraw ./a.out && build/bin/llvm-profdata merge -output=a.profdata a.profraw
$ LLVM_PROFILE_FILE=b.profraw ./a.out foo && build/bin/llvm-profdata merge -output=b.profdata b.profraw

$ build/bin/clang -O2 -flto=thin -fprofile-use=a.profdata -c /tmp/a.c
$ build/bin/clang -O2 -flto=thin -fprofile-use=b.profdata -c /tmp/b.c
$ build/bin/clang -O2 -flto=thin -fuse-ld=lld a.o b.o
ld.lld: error: Function Import: link error: linking module flags 'ProfileSummary': IDs have conflicting values: '<0x7f52dc008d50> = !{<0x7f52dc013e70>, <0x7f52dc020a30>, <0x7f52dc020ba0>, <0x7f52dc020be0>, <0x7f52dc003c40>, <0x7f52dc020c20>, <0x7f52dc014c10>, <0x7f52dc014c50>, <0x7f52dc0152a0>, <0x7f52dc0212b0>}' from b.o, and '<0x7f52dc0111a0> = !{<0x7f52dc013e70>, <0x7f52dc013eb0>, <0x7f52dc013ef0>, <0x7f52dc013f30>, <0x7f52dc013f70>, <0x7f52dc0145c0>, <0x7f52dc014c10>, <0x7f52dc014c50>, <0x7f52dc0152a0>, <0x7f52dc0161c0>}' from a.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

At least after f53de29862193b761f3ef8ec0627d1e70d2fe674 the linker doesn't crash, but the message sounds like it's reporting an internal problem.

Can we find a more user friendly message? Maybe something like: "ThinLTO function import error: module a.o and b.o were compiled with different profile data".
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to