[PATCH] D125511: [InstCombine] Merging constant-indexed GEP of GEP in both directions

William Junda Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 13 18:11:42 PDT 2022


huangjd added a comment.

@nikic 
I will add converting constant GEP to i8* in the next patch. The existing merging functionality can handle GEP with not all constant indices, such as

  %1 = gep {i32, i32, i32}, ptr %p, i64 %a, i32 1
  %2 = gep i32, ptr %1, i64 1

Such expression cannot be convert to GEP of i8 without creating a complicated index expression, which is basically moving instruction selection to the front. It is unreasonable that merge only allows one direction but not the other, given use-def constraints satisfied.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125511



More information about the llvm-commits mailing list