[llvm] [RemoveDIs] Load into new debug info format by default in LLVM (PR #89799)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed May 22 23:53:05 PDT 2024
MaskRay wrote:
> > I am sorry but I am going to revert this patch. The stage-2 IR verifier error is from a ThinLTO+SamplePGO build.
>
> I've got stage-2 ThinLTO+SPGO build of clang using the flags you included but can't reproduce the error - do you have any more information that might be relevant to reproducing the error? Otherwise I'll continue to dig at the rest of the info you've provided to see if I can see an obvious cause of failure, and see if we can find some way to verify a fix without having to repeatedly land and revert until the fix is confirmed.
I am able to reproduce the assertion failure using an internal sample profile in a ThinLTO+SamplePGO+split DWARF build at current HEAD.
Disabling any of these three optimizations (ThinLTO, SamplePGO, or split DWARF) resolves the assertion failure.
```
llvm-project/llvm/lib/Linker/IRMover.cpp:260 in Type *(anonymous namespace)::TypeMapTy::get(Type *, SmallPtrSet<StructType *, 8>
&): !(Pair.first != Ty && Pair.second == Ty) && "mapping to a source type"
```
The sample profile file matters. I've tried a simpler profile using llvm-test-suite `sqlite3.i` (below), but that doesn't reproduce the crash.
* reland #89799
* create a stage 1 build
* Create a stage 2 ThinLTO+SamplePGO+split DWARF build: `configure-llvm s2-custom-fdo -DLLVM_TARGETS_TO_BUILD=host -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_{C,CXX}_FLAGS='-g -fdebug-info-for-profiling -funique-internal-linkage-names' -DCMAKE_EXE_LINKER_FLAGS=-Wl,--build-id -DLLVM_USE_SPLIT_DWARF=on -DLLVM_ENABLE_LTO=Thin`
* Preprocess llvm-test-suite `sqlite.c` to `sqlite.i`: `clang -DNDEBUG -w -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -I. -E llvm-test-suite/MultiSource/Applications/sqlite3/sqlite3.c -o sqlite3.i`
* Collect `perf.data` using `sqlite3.i` on an machine with an Intel CPU: `perf record -b -e BR_INST_RETIRED.NEAR_TAKEN:uppp -- /tmp/out/s2-custom-fdo/bin/clang -c -O1 sqlite3.i`
* `create_llvm_prof --binary=/tmp/out/s2-custom-fdo/bin/clang --profile=perf.data --out=clang.prof`
* `configure-llvm s2-custom-use -DLLVM_TARGETS_TO_BUILD=host -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_{C,CXX}_FLAGS='-g -fdebug-info-for-profiling -funique-internal-linkage-names -fprofile-sample-use=/t/clang.prof' -DLLVM_USE_SPLIT_DWARF=on -DLLVM_ENABLE_LTO=Thin`
I know that the task is still on our side to figure out the issue, as this seems really difficult on your side.
https://github.com/llvm/llvm-project/pull/89799
More information about the llvm-commits
mailing list