[all-commits] [llvm/llvm-project] e72209: [MachineSink] Fix stable sort comparator (#116705)

Ellis Hoag via All-commits all-commits at lists.llvm.org
Tue Nov 19 16:15:58 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e72209db3586ee03f433fe30c3bfac6c9c4d9d6f
      https://github.com/llvm/llvm-project/commit/e72209db3586ee03f433fe30c3bfac6c9c4d9d6f
  Author: Ellis Hoag <ellis.sparky.hoag at gmail.com>
  Date:   2024-11-19 (Tue, 19 Nov 2024)

  Changed paths:
    M llvm/lib/CodeGen/MachineSink.cpp

  Log Message:
  -----------
  [MachineSink] Fix stable sort comparator (#116705)

Fix the comparator in `stable_sort()` to satisfy the strict weak
ordering requirement.

In https://github.com/llvm/llvm-project/pull/115367 this comparator was
changed to use `getCycleDepth()` when `shouldOptimizeForSize()` is true.
However, I mistakenly changed to logic so that we use `LHSFreq <
RHSFreq` if **either** of them are zero. This causes us to fail the last
requirment (https://en.cppreference.com/w/cpp/named_req/Compare).

> if comp(a, b) == true and comp(b, c) == true then comp(a, c) == true



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list