[PATCH] D129734: [InstCombine] Canonicalize GEP of GEP by swapping constant-indexed GEP to the front

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 00:24:37 PDT 2022


nikic added a comment.

I think this will do worse in practice, because it breaks GVN. Imagine you have accesses like `ary[i].x`, `ary[i].y`, `ary[i].z` represented with two GEPs. If constants are canonicalized to the end, then the `ary[i]` GEP is the same all three times and can be CSEd/GVNd. If the constants are canonicalized to the start, then these all become distinct GEPs on different bases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129734



More information about the llvm-commits mailing list