[PATCH] D77523: Add CanonicalizeFreezeInLoops pass

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 03:14:43 PDT 2020


aqjune updated this revision to Diff 257644.
aqjune added a comment.

I found that dealing with multiple phis had problems, so had to change the
algorithm.
Rather than having a candidate for each (auxiliary) induction PHI, now it
just maintains three sets:

- InstsToDropFlags: instructions to drop flags like nsw/nuw
- FIsToRemove: Freeze insts to remove
- UsesToInsertFr: Uses (Value, User) which should be frozen so

it becomes (freeze(Value), User). The frozen values are placed at
the loop preheader.

What CanonicalizeFreezeInLoopsImpl::run does is:

(1) Gets reachable instructions from auxiliary induction PHIs (upto MaxDepth step)
(2) For each freeze among the reachable instructions, see whether it can be
pushed out of the loop by seeing instructions among paths from PHI to the freeze
whether their flags can be dropped / relevant users can be frozen. If not, the
freeze cannot be pushed out of the loop.
(3) For all 'pushable' freezes, push them out of the loop.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77523

Files:
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/Transforms/Utils.h
  llvm/include/llvm/Transforms/Utils/CanonicalizeFreezeInLoops.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Utils/CMakeLists.txt
  llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
  llvm/lib/Transforms/Utils/Utils.cpp
  llvm/test/Transforms/CanonicalizeFreezeInLoops/onephi.ll
  llvm/test/Transforms/CanonicalizeFreezeInLoops/phis.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77523.257644.patch
Type: text/x-patch
Size: 38469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/f8dcd6af/attachment-0001.bin>


More information about the llvm-commits mailing list