[llvm-branch-commits] [llvm] 1e260f9 - [LICM][docs] Document that LICM is also a canonicalization transform. NFC.

Sjoerd Meijer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 8 04:02:05 PST 2020


Author: Sjoerd Meijer
Date: 2020-12-08T11:56:35Z
New Revision: 1e260f955d3123351fc68de8c2dde02b1be6d14f

URL: https://github.com/llvm/llvm-project/commit/1e260f955d3123351fc68de8c2dde02b1be6d14f
DIFF: https://github.com/llvm/llvm-project/commit/1e260f955d3123351fc68de8c2dde02b1be6d14f.diff

LOG: [LICM][docs] Document that LICM is also a canonicalization transform. NFC.

This documents that LICM is a canonicalization transform, which we discussed
recently in:

http://lists.llvm.org/pipermail/llvm-dev/2020-December/147184.html

but which was also discused earlier, e.g. in:

http://lists.llvm.org/pipermail/llvm-dev/2019-September/135058.html

Added: 
    

Modified: 
    llvm/docs/Passes.rst
    llvm/lib/Transforms/Scalar/LICM.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/docs/Passes.rst b/llvm/docs/Passes.rst
index 202e3ab223d6..d146ce745282 100644
--- a/llvm/docs/Passes.rst
+++ b/llvm/docs/Passes.rst
@@ -720,6 +720,12 @@ into the preheader block, or by sinking code to the exit blocks if it is safe.
 This pass also promotes must-aliased memory locations in the loop to live in
 registers, thus hoisting and sinking "invariant" loads and stores.
 
+Hoisting operations out of loops is a canonicalization transform. It enables
+and simplifies subsequent optimizations in the middle-end. Rematerialization
+of hoisted instructions to reduce register pressure is the responsibility of
+the back-end, which has more accurate information about register pressure and
+also handles other optimizations than LICM that increase live-ranges.
+
 This pass uses alias analysis for two purposes:
 
 #. Moving loop invariant loads and calls out of loops.  If we can determine

diff  --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 9d90986c54ad..1b14bc972a9e 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -12,6 +12,13 @@
 // safe.  This pass also promotes must-aliased memory locations in the loop to
 // live in registers, thus hoisting and sinking "invariant" loads and stores.
 //
+// Hoisting operations out of loops is a canonicalization transform.  It
+// enables and simplifies subsequent optimizations in the middle-end.
+// Rematerialization of hoisted instructions to reduce register pressure is the
+// responsibility of the back-end, which has more accurate information about
+// register pressure and also handles other optimizations than LICM that
+// increase live-ranges.
+//
 // This pass uses alias analysis for two purposes:
 //
 //  1. Moving loop invariant loads and calls out of loops.  If we can determine


        


More information about the llvm-branch-commits mailing list