[PATCH] D125845: [InstCombine] Canonicalize GEP of GEP by swapping constant-indexed GEP to the back

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 01:37:42 PDT 2022


nikic added a comment.

This looks fine to me, but maybe @spatel can also take a look.



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:1964
+  // first may miss the LICM opportunity.
+  bool shouldCanonicalizeSwap = true;
+
----------------
-> `ShouldCanonicalizeSwap`


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:1978
+        // the swapping below.
+        if (!L->isLoopInvariant(GO1) && L->isLoopInvariant(SO1)) {
+          shouldCanonicalizeSwap = false;
----------------
Omit braces for single-statement if.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125845/new/

https://reviews.llvm.org/D125845



More information about the llvm-commits mailing list