[PATCH] D125776: [llvm-debuginfo-analyzer] 01 - Interval tree

Carlos Alberto Enciso via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 04:55:16 PDT 2022


CarlosAlbertoEnciso added a comment.

In D125776#3820399 <https://reviews.llvm.org/D125776#3820399>, @antondaubert wrote:

> In D125776#3818052 <https://reviews.llvm.org/D125776#3818052>, @CarlosAlbertoEnciso wrote:
>
>> I will investigate it on a local debug build.
>> Can you provide me with more information on you local build environment:
>> CMake command line, platform, compiler, etc.
>>
>> Thanks
>
> Our build setup is based on the internal version of bazel. As mentioned I was able to reproduce this failure in around 80% in debug build. Maybe it is related to the usage of std::sort. Consider looking into https://libcxx.llvm.org/DesignDocs/UnspecifiedBehaviorRandomization.html. We have _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY enabled in our debug builds specifically to find this sort of a reliance on a specific ordering of partially ordered elements after std::sort.

Thanks for the notes about https://libcxx.llvm.org/DesignDocs/UnspecifiedBehaviorRandomization.html
Please, can I have more specific details on your build configuration options, so I can build with `_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY` enabled.

In the meantime, I would suggest to replace `std::sort` with `std::stable_sort` in your `llvm\include\llvm\ADT\IntervalTree.h` version.

  // Sort intervals on the left and right of the middle point.
  if (NewBucketSize > 1) {
    // Sort the intervals in ascending order by their beginning point.
    std::sort(IntervalsLeft.begin() + NewBucketStart,
              IntervalsLeft.begin() + NewBucketStart + NewBucketSize,
              [](const DataType *LHS, const DataType *RHS) {
                return LHS->left() < RHS->left();
              });
    // Sort the intervals in descending order by their ending point.
    std::sort(IntervalsRight.begin() + NewBucketStart,
              IntervalsRight.begin() + NewBucketStart + NewBucketSize,
              [](const DataType *LHS, const DataType *RHS) {
                return LHS->right() > RHS->right();
              });
  }

Thanks


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125776/new/

https://reviews.llvm.org/D125776



More information about the llvm-commits mailing list