[llvm] [InstCombine] Make `takeLog2` usable throughout InstCombine; NFC (PR #122498)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 12:55:43 PST 2025


================
@@ -785,6 +785,18 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
   void handlePotentiallyDeadBlocks(SmallVectorImpl<BasicBlock *> &Worklist);
   void handlePotentiallyDeadSuccessors(BasicBlock *BB, BasicBlock *LiveSucc);
   void freelyInvertAllUsersOf(Value *V, Value *IgnoredUser = nullptr);
+
+  // Take the exact integer log2 of the value. If DoFold is true, create the
+  // actual instructions, otherwise return a non-null dummy value. Return
+  // nullptr on failure. Note, if DoFold is true the caller must ensure that
+  // takeLog2 will succeed, otherwise it may create stray instructions.
----------------
nikic wrote:

```suggestion
  /// Take the exact integer log2 of the value. If DoFold is true, create the
  /// actual instructions, otherwise return a non-null dummy value. Return
  /// nullptr on failure. Note, if DoFold is true the caller must ensure that
  /// takeLog2 will succeed, otherwise it may create stray instructions.
```

https://github.com/llvm/llvm-project/pull/122498


More information about the llvm-commits mailing list