[PATCH] D116588: [LoopInfo] Clarify description of makeLoopInvariant. NFC.

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 4 03:01:39 PST 2022


SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: fhahn, Whitney, reames.
SjoerdMeijer requested review of this revision.
Herald added a project: LLVM.

Clarify that `Changed` is set to true if the instruction/value was made loop-invariant; the function is returning true if it was already invariant.


https://reviews.llvm.org/D116588

Files:
  llvm/include/llvm/Analysis/LoopInfo.h


Index: llvm/include/llvm/Analysis/LoopInfo.h
===================================================================
--- llvm/include/llvm/Analysis/LoopInfo.h
+++ llvm/include/llvm/Analysis/LoopInfo.h
@@ -557,21 +557,24 @@
 
   /// If the given value is an instruction inside of the loop and it can be
   /// hoisted, do so to make it trivially loop-invariant.
-  /// Return true if the value after any hoisting is loop invariant. This
-  /// function can be used as a slightly more aggressive replacement for
-  /// isLoopInvariant.
+  /// Return true if \c V is already loop-invariant, and false if \c V can't
+  /// be made loop-invariant. If \c V is made loop-invariant, \c Changed is
+  /// set to true. This function can be used as a slightly more aggressive
+  /// replacement for isLoopInvariant.
   ///
   /// If InsertPt is specified, it is the point to hoist instructions to.
   /// If null, the terminator of the loop preheader is used.
+  ///
   bool makeLoopInvariant(Value *V, bool &Changed,
                          Instruction *InsertPt = nullptr,
                          MemorySSAUpdater *MSSAU = nullptr) const;
 
   /// If the given instruction is inside of the loop and it can be hoisted, do
   /// so to make it trivially loop-invariant.
-  /// Return true if the instruction after any hoisting is loop invariant. This
-  /// function can be used as a slightly more aggressive replacement for
-  /// isLoopInvariant.
+  /// Return true if \c I is already loop-invariant, and false if \c I can't
+  /// be made loop-invariant. If \c I is made loop-invariant, \c Changed is
+  /// set to true. This function can be used as a slightly more aggressive
+  /// replacement for isLoopInvariant.
   ///
   /// If InsertPt is specified, it is the point to hoist instructions to.
   /// If null, the terminator of the loop preheader is used.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116588.397244.patch
Type: text/x-patch
Size: 1853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220104/2e9c8a80/attachment.bin>


More information about the llvm-commits mailing list