[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
Sun May 22 13:59:53 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]]
----------------
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?


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