[PATCH] D137664: [InstCombine][NFC] Baseline tests for D137212 Simplify chain of GEP with constant indices

William Junda Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 16:00:46 PST 2022


huangjd added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/gep-merge-constant-indices.ll:277
+  %2 = getelementptr inbounds i32, ptr %1, i64 %a
+  %3 = getelementptr inbounds [4 x i16], ptr %2, i64 1, i64 -4
+  ret ptr %3
----------------
spatel wrote:
> It's not clear to me that this test is providing coverage for the intended constraint in the other patch. 
> 
> Should we add a simplify for any gep like %3?
> https://alive2.llvm.org/ce/z/w89_Y5
GEP with zero offset is simplified away by visitGEPOfGEP regardless what the preceding GEP is, so there is no way to keep it in the output 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137664



More information about the llvm-commits mailing list