[llvm] 9b0ebb5 - [LoopInfo] Clarify description of `makeLoopInvariant`. NFC.

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 5 01:09:11 PST 2022


Author: Sjoerd Meijer
Date: 2022-01-05T08:57:59Z
New Revision: 9b0ebb54da01be5519decb5ed23365d28d740f70

URL: https://github.com/llvm/llvm-project/commit/9b0ebb54da01be5519decb5ed23365d28d740f70
DIFF: https://github.com/llvm/llvm-project/commit/9b0ebb54da01be5519decb5ed23365d28d740f70.diff

LOG: [LoopInfo] Clarify description of `makeLoopInvariant`. NFC.

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.

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h
index 15c9d911ab809..b2326c4714dd2 100644
--- a/llvm/include/llvm/Analysis/LoopInfo.h
+++ b/llvm/include/llvm/Analysis/LoopInfo.h
@@ -557,21 +557,24 @@ class LLVM_EXTERNAL_VISIBILITY Loop : public LoopBase<BasicBlock, Loop> {
 
   /// 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.


        


More information about the llvm-commits mailing list