[all-commits] [llvm/llvm-project] d9da6a: [LICM][PhaseOrder] Don't speculate in LICM until a...

William Moses via All-commits all-commits at lists.llvm.org
Thu Feb 17 17:13:19 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d9da6a535f21946cfaac1516ef28ac7646211d56
      https://github.com/llvm/llvm-project/commit/d9da6a535f21946cfaac1516ef28ac7646211d56
  Author: William S. Moses <gh at wsmoses.com>
  Date:   2022-02-17 (Thu, 17 Feb 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/Scalar.h
    M llvm/include/llvm/Transforms/Scalar/LICM.h
    M llvm/include/llvm/Transforms/Utils/LoopUtils.h
    M llvm/lib/Passes/PassBuilderPipelines.cpp
    M llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
    M llvm/lib/Transforms/Scalar/LICM.cpp
    M llvm/test/Transforms/LoopUnroll/AArch64/runtime-unroll-generic.ll
    M llvm/test/Transforms/PhaseOrdering/AArch64/matrix-extract-insert.ll
    M llvm/test/Transforms/PhaseOrdering/X86/hoist-load-of-baseptr.ll
    M llvm/test/Transforms/PhaseOrdering/X86/speculation-vs-tbaa.ll
    M llvm/test/Transforms/PhaseOrdering/X86/spurious-peeling.ll

  Log Message:
  -----------
  [LICM][PhaseOrder] Don't speculate in LICM until after running loop rotate

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.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D119965




More information about the All-commits mailing list