[PATCH] D71990: [LoopUtils] Better accuracy for getLoopEstimatedTripCount.

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 30 00:44:43 PST 2019


ebrevnov created this revision.
Herald added subscribers: llvm-commits, zzheng, hiraditya, mgorny.
Herald added a project: LLVM.

Current implementation of getLoopEstimatedTripCount returns 1 iteration less than it should. The reason is that in bottom tested loop first iteration is executed before first back branch is taken. For example for loop with !{!"branch_weights", i32 1 // taken, i32 1 // exit} metadata getLoopEstimatedTripCount gives 1 while actual number of iterations is 2.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71990

Files:
  llvm/include/llvm/Support/MathExtras.h
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/test/Transforms/LoopUnroll/peel-loop-conditions-pgo-1.ll
  llvm/test/Transforms/LoopUnroll/peel-loop-pgo-deopt-idom-2.ll
  llvm/test/Transforms/LoopUnroll/peel-loop-pgo-deopt-idom.ll
  llvm/test/Transforms/LoopUnroll/peel-loop-pgo-deopt.ll
  llvm/test/Transforms/LoopUnroll/peel-loop-pgo.ll
  llvm/unittests/Transforms/Utils/CMakeLists.txt
  llvm/unittests/Transforms/Utils/LoopUtilsTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71990.235561.patch
Type: text/x-patch
Size: 9723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191230/6bb6a20d/attachment.bin>


More information about the llvm-commits mailing list