DKLoehr wrote: Alright, I've managed to put together the following standalone reproduction; it's based on our build script, but I tested it with a standalone LLVM checkout and it did manage to reproduce the bug. I'm running this on an arm mac (M3), since that was the only bot that was showing this failure. It's using ninja, but presumably should still reproduce with other build systems.
The following commands assume that you're in a sibling directory of `llvm-project`. ``` # Build stage 1 compiler cmake -GNinja -B build-stage1 -S ../llvm-project/llvm \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_PROJECTS="clang;lld" \ -DLLVM_ENABLE_RUNTIMES="compiler-rt" \ -DCOMPILER_RT_BUILD_PROFILE=ON \ -DCOMPILER_RT_BUILD_SANITIZERS=OFF \ -DCOMPILER_RT_BUILD_XRAY=OFF \ -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \ -DCOMPILER_RT_ENABLE_IOS=OFF \ -DCOMPILER_RT_ENABLE_WATCHOS=OFF \ -DCOMPILER_RT_ENABLE_TVOS=OFF \ -DLLVM_TARGETS_TO_BUILD="AArch64;X86" ninja -C build-stage1 clang lld llvm-profdata runtimes # Build instrumented compiler to collect PGO data cmake -GNinja -B build-instrumented -S ../llvm-project/llvm \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER="$(pwd)/build-stage1/bin/clang" \ -DCMAKE_CXX_COMPILER="$(pwd)/build-stage1/bin/clang++" \ -DLLVM_ENABLE_PROJECTS="clang;lld" \ -DLLVM_BUILD_INSTRUMENTED=IR \ -DLLVM_BUILD_RUNTIME=OFF \ -DLLVM_TARGETS_TO_BUILD="AArch64;X86" ninja -C build-instrumented clang lld # Compile something to collect PGO data mkdir profile export LLVM_PROFILE_FILE="$(pwd)/profiles/code-%p.profraw" ./build-instrumented/bin/clang++ -O2 -std=c++17 \ -isysroot $(xcrun --show-sdk-path) \ -Ibuild-instrumented/include \ -I../llvm-project/llvm/include \ -c ../llvm-project/llvm/lib/Transforms/Scalar/GVN.cpp -o /dev/null ./build-stage1/bin/llvm-profdata merge -output="$(pwd)/profdata.prof" profiles/*.profraw # Build final compiler cmake -GNinja -B build-stage3 -S ../llvm-project/llvm \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_ASSERTIONS=OFF \ -DCMAKE_C_COMPILER="$(pwd)/build-stage1/bin/clang" \ -DCMAKE_CXX_COMPILER="$(pwd)/build-stage1/bin/clang++" \ -DLLVM_ENABLE_PROJECTS="clang;lld" \ -DLLVM_PROFDATA_FILE="$(pwd)/profdata.prof" \ -DLLVM_INCLUDE_TESTS=ON \ -DLLVM_TARGETS_TO_BUILD="AArch64;X86" ninja -C build-stage3 ADTTests ./build-stage3/unittests/ADT/ADTTests --gtest_filter=RangeAdapterLValueTest/0.TrivialOperation ``` Result: Test fails. If stage3 is built without PGO, or with `-fwrapv-pointer`, then the test passes. https://github.com/llvm/llvm-project/pull/210729 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
