[PATCH] D125438: [InstCombine] NEW Baseline tests for InstCombine optimization to merge GEP instructions with constant indices

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 08:42:42 PDT 2022


nlopes added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/gep-merge-constant-indices.ll:109
+; CHECK-LABEL: @struct2(
+; CHECK-NEXT:    [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_A:%.*]], ptr [[P:%.*]], i64 -1, i32 1
+; CHECK-NEXT:    ret ptr [[TMP1]]
----------------
nlopes wrote:
> This transformation is incorrect, as the inbounds constraint is applied for each index, from left-to-right. Thus we can't introduce the -1 before the positive increment.
> Not sure we need a condition this strong, but it allows easier decomposition of 1 gep into multiple ones.
> 
> Do we have a bug report tracking this issue or any patch under review?
ping?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125438



More information about the llvm-commits mailing list