[PATCH] D124725: [NFC][LoopCacheAnalysis] Use stable_sort() to avoid non-deterministic print output

Congzhe Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 30 19:47:36 PDT 2022


congzhe created this revision.
congzhe added reviewers: Meinersbur, bmahjour, nikic, fhahn, LoopOptWG.
congzhe added projects: LLVM, LoopOptWG.
Herald added subscribers: mgrang, nemanjai.
Herald added a project: All.
congzhe requested review of this revision.
Herald added a subscriber: llvm-commits.

As per discussion in https://reviews.llvm.org/D122857#3483861, https://reviews.llvm.org/D122857#3483912,
the print output of loop cache analysis sometimes has a non-deterministic order (and therefore we have been using `CHECK-DAG` in its lit tests).

This patch changes the sorting of LoopCosts to llvm::stable_sort() where we compare loop cost numbers and sort the loops. In case of the same loop cost numbers, llvm::stable_sort() now would output a deterministic loop order.

Comments on this patch are appreciated :)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124725

Files:
  llvm/include/llvm/Analysis/LoopCacheAnalysis.h
  llvm/test/Analysis/LoopCacheAnalysis/PowerPC/LoopnestFixedSize.ll
  llvm/test/Analysis/LoopCacheAnalysis/PowerPC/loads-store.ll
  llvm/test/Analysis/LoopCacheAnalysis/PowerPC/matmul.ll
  llvm/test/Analysis/LoopCacheAnalysis/PowerPC/matvecmul.ll
  llvm/test/Analysis/LoopCacheAnalysis/PowerPC/single-store.ll
  llvm/test/Analysis/LoopCacheAnalysis/PowerPC/stencil.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124725.426261.patch
Type: text/x-patch
Size: 5638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220501/f6c8fe11/attachment.bin>


More information about the llvm-commits mailing list