[PATCH] D131606: [Loop Fusion] Sink/hoist memory instructions between loop fusion candidates

Aaron K via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 11:20:27 PDT 2022


aaronkintel created this revision.
aaronkintel added reviewers: anna, TaWeiTu, kazu, sidbav, Whitney.
aaronkintel added a project: LLVM.
Herald added a subscriber: hiraditya.
Herald added a project: All.
aaronkintel requested review of this revision.
Herald added a subscriber: llvm-commits.

Currently, instructions in the preheader of the second of two fusion candidates are sunk and hoisted whenever possible, to try to allow the loops to fuse. Memory instructions are skipped, and are never sunk or hoisted. This change adds memory instructions for sinking/hoisting consideration.

This change uses DependenceAnalysis to check if a mem inst in the preheader of FC1 depends on an instruction in FC0's header, across which it will be hoisted, or FC1's header, across which it will be sunk. We reject cases where the dependency is a data hazard.


https://reviews.llvm.org/D131606

Files:
  llvm/lib/Transforms/Scalar/LoopFuse.cpp
  llvm/test/Transforms/LoopFusion/no_sink_hoist_load.ll
  llvm/test/Transforms/LoopFusion/no_sink_hoist_store.ll
  llvm/test/Transforms/LoopFusion/no_sink_hoist_unknown_function.ll
  llvm/test/Transforms/LoopFusion/simple.ll
  llvm/test/Transforms/LoopFusion/sink_load.ll
  llvm/test/Transforms/LoopFusion/sink_store.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131606.451576.patch
Type: text/x-patch
Size: 16289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220810/64d68943/attachment.bin>


More information about the llvm-commits mailing list