[PATCH] D113287: [WIP] [SeparateConstOffsetFromGEP] Add an option to enable GEP lowering

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 5 08:18:13 PDT 2021


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

This could be useful for testing of the SeparateConstOffsetFromGEP Pass.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113287

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
@@ -212,6 +212,9 @@
                      cl::desc("Verify this pass produces no dead code"),
                      cl::Hidden);
 
+static cl::opt<bool> LowerGEPOpt("lower-gep", cl::init(false),
+                                 cl::desc("Enable GEP lowering"), cl::Hidden);
+
 namespace {
 
 /// A helper class for separating a constant offset from a GEP index.
@@ -1150,6 +1153,9 @@
   if (DisableSeparateConstOffsetFromGEP)
     return false;
 
+  if (LowerGEPOpt)
+    LowerGEP = true;
+
   auto *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
   auto *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
   auto *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
@@ -1165,6 +1171,9 @@
   if (DisableSeparateConstOffsetFromGEP)
     return false;
 
+  if (LowerGEPOpt)
+    LowerGEP = true;
+
   DL = &F.getParent()->getDataLayout();
   bool Changed = false;
   for (BasicBlock &B : F) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113287.385081.patch
Type: text/x-patch
Size: 1173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211105/5281df1d/attachment.bin>


More information about the llvm-commits mailing list