[PATCH] D131572: [NFC][SeparateConstOffsetFromGEP] Small refactoring and reformatting

Elena Lepilkina via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 07:55:44 PDT 2022


eklepilkina created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
eklepilkina requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131572

Files:
  llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp


Index: llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
+++ llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
@@ -187,6 +187,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/Scalar.h"
@@ -198,6 +199,8 @@
 using namespace llvm;
 using namespace llvm::PatternMatch;
 
+#define DEBUG_TYPE "separate-const-offset-from-gep"
+
 static cl::opt<bool> DisableSeparateConstOffsetFromGEP(
     "disable-separate-const-offset-from-gep", cl::init(false),
     cl::desc("Do not separate the constant offset from a GEP instruction"),
@@ -254,15 +257,15 @@
   /// successful, returns C and update UserChain as a def-use chain from C to V;
   /// otherwise, UserChain is empty.
   ///
-  /// \p V            The given expression
-  /// \p SignExtended Whether V will be sign-extended in the computation of the
-  ///                 GEP index
-  /// \p ZeroExtended Whether V will be zero-extended in the computation of the
-  ///                 GEP index
-  /// \p NonNegative  Whether V is guaranteed to be non-negative. For example,
-  ///                 an index of an inbounds GEP is guaranteed to be
-  ///                 non-negative. Levaraging this, we can better split
-  ///                 inbounds GEPs.
+  /// \p V                    The given expression
+  /// \p SignExtended         Whether V will be sign-extended in the computation
+  ///                         of the GEP index
+  /// \p ZeroExtended         Whether V will be zero-extended in the computation
+  ///                         of the GEP index
+  /// \p NonNegative          Whether V is guaranteed to be non-negative. For
+  ///                         example, an index of an inbounds GEP is guaranteed
+  ///                         to be non-negative. Levaraging this, we can better
+  ///                         split inbounds GEPs.
   APInt find(Value *V, bool SignExtended, bool ZeroExtended, bool NonNegative);
 
   /// A helper function to look into both operands of a binary operator.
@@ -1162,6 +1165,9 @@
 
   DL = &F.getParent()->getDataLayout();
   bool Changed = false;
+
+  LLVM_DEBUG(dbgs() << "========= Function " << F.getName() << " =========\n");
+
   for (BasicBlock &B : F) {
     if (!DT->isReachableFromEntry(&B))
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131572.451462.patch
Type: text/x-patch
Size: 2569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220810/cce03d2f/attachment.bin>


More information about the llvm-commits mailing list