llvm/llvm/test/Transforms/InstCombine/pr58901.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s

define ptr @f1(ptr %arg, i64 %arg1) {
; CHECK-LABEL: @f1(
; CHECK-NEXT:    [[TMP1:%.*]] = getelementptr i8, ptr [[ARG:%.*]], i64 72
; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr [6 x i32], ptr [[TMP1]], i64 0, i64 [[ARG1:%.*]]
; CHECK-NEXT:    ret ptr [[TMP2]]
;
  %1 = getelementptr [6 x i32], ptr %arg, i64 3
  %2 = getelementptr [6 x i32], ptr %1, i64 0, i64 %arg1
  ret ptr %2
}

define ptr @f2(ptr %arg, i64 %arg1) {
; CHECK-LABEL: @f2(
; CHECK-NEXT:    [[TMP1:%.*]] = getelementptr i8, ptr [[ARG:%.*]], i64 72
; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr [6 x i32], ptr [[TMP1]], i64 [[ARG1:%.*]], i64 [[ARG1]]
; CHECK-NEXT:    ret ptr [[TMP2]]
;
  %1 = getelementptr [6 x i32], ptr %arg, i64 3
  %2 = getelementptr [6 x i32], ptr %1, i64 %arg1, i64 %arg1
  ret ptr %2
}