[PATCH] D119965: [LICM][PhaseOrder] Don't speculate LICM until after running loop rotate

William Moses via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 16 11:37:44 PST 2022


wsmoses created this revision.
wsmoses added reviewers: jdoerfert, nikic, vchuravy, lebedev.ri, fhahn, jeroen.dobbelaere.
Herald added subscribers: ormris, asbirlea, hiraditya.
wsmoses requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

LICM will speculatively hoist code outside of loops. This requires removing information, like alias analysis (https://github.com/llvm/llvm-project/issues/53794), range information (https://bugs.llvm.org/show_bug.cgi?id=50550), among others. Prior to https://reviews.llvm.org/D99249 , LICM would only be run after LoopRotate. Running Loop Rotate prior to LICM prevents a instruction hoist from being speculative, if it was conditionally executed by the iteration (as is commonly emitted by clang and other frontends). Adding the additional LICM pass first, however, forces all of these instructions to be considered speculative, even if they are not speculative after LoopRotate. This destroys information, resulting in performance losses for discarding this additional information.

This PR modifies LICM to accept a ``speculative'' parameter which allows LICM to be set to perform information-loss speculative hoists or not. Phase ordering is then modified to not perform the information-losing speculative hoists until after loop rotate is performed, preserving this additional information.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119965

Files:
  llvm/include/llvm/Transforms/Scalar.h
  llvm/include/llvm/Transforms/Scalar/LICM.h
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/test/Transforms/PhaseOrdering/X86/spurious-peeling.ll
  llvm/test/Transforms/PhaseOrdering/speclicm.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119965.409348.patch
Type: text/x-patch
Size: 25574 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220216/49f2011e/attachment.bin>


More information about the llvm-commits mailing list