[PATCH] D39906: [InstCombine] Allowing GEP Instructions with loop Invariant operands to combine

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 17:08:22 PST 2017


efriedma added a comment.

> And for the cases where the extra instructions are produced, gep(gep ...) merging optimization happens only when the second operands are loop invariant , and hence LICM pass will move them out of the loop.

"L" here is the innermost loop relative to the GEP.  The innermost loop might not be the important loop (e.g. it might have a low trip count and get unrolled).  And even if the addition is hoisted out of the hottest loop, you're still increasing codesize and register pressure.

Do you have numbers for LLVM testsuite or SPEC or something?



================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:1712
+        if (Sum == nullptr)
+          return nullptr;
+      }
----------------
CreateAdd can't return nullptr.


https://reviews.llvm.org/D39906





More information about the llvm-commits mailing list