[all-commits] [llvm/llvm-project] 5c0d1b: [LoopUnroll] Eliminate PreserveCondBr parameter an...
    Philip Reames via All-commits 
    all-commits at lists.llvm.org
       
    Thu Jun  3 14:10:18 PDT 2021
    
    
  
  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5c0d1b2f902aa6a9cf47cc7e42c5b83bb2217cf9
      https://github.com/llvm/llvm-project/commit/5c0d1b2f902aa6a9cf47cc7e42c5b83bb2217cf9
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-06-03 (Thu, 03 Jun 2021)
  Changed paths:
    M llvm/include/llvm/Transforms/Utils/UnrollLoop.h
    M llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
    M llvm/lib/Transforms/Utils/LoopUnroll.cpp
    M llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
    M llvm/test/Transforms/LoopUnroll/pr45939-peel-count-and-complete-unroll.ll
  Log Message:
  -----------
  [LoopUnroll] Eliminate PreserveCondBr parameter and fix a bug in the process
This builds on D103584. The change eliminates the coupling between unroll heuristic and implementation w.r.t. knowing when the passed in trip count is an exact trip count or a max trip count. In theory the new code is slightly less powerful (since it relies on exact computable trip counts), but in practice, it appears to cover all the same cases. It can also be extended if needed.
The test change shows what appears to be a bug in the existing code around the interaction of peeling and unrolling. The original loop only ran 8 iterations. The previous output had the loop peeled by 2, and then an exact unroll of 8. This meant the loop ran a total of 10 iterations which appears to have been a miscompile.
Differential Revision: https://reviews.llvm.org/D103620
    
    
More information about the All-commits
mailing list