Compiler projects using llvm
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=TYPED
// RUN: %clang_cc1 -opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=OPAQUE

// TYPED-LABEL: @test(
// TYPED-NEXT:  entry:
// TYPED-NEXT:    [[P_ADDR:%.*]] = alloca i32*, align 8
// TYPED-NEXT:    store i32* [[P:%.*]], i32** [[P_ADDR]], align 8
// TYPED-NEXT:    [[TMP0:%.*]] = load i32*, i32** [[P_ADDR]], align 8
// TYPED-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 1
// TYPED-NEXT:    [[TMP1:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
// TYPED-NEXT:    ret i32 [[TMP1]]
//
// OPAQUE-LABEL: @test(
// OPAQUE-NEXT:  entry:
// OPAQUE-NEXT:    [[P_ADDR:%.*]] = alloca ptr, align 8
// OPAQUE-NEXT:    store ptr [[P:%.*]], ptr [[P_ADDR]], align 8
// OPAQUE-NEXT:    [[TMP0:%.*]] = load ptr, ptr [[P_ADDR]], align 8
// OPAQUE-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 1
// OPAQUE-NEXT:    [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
// OPAQUE-NEXT:    ret i32 [[TMP1]]
//
int test(int *p) {
  return p[1];
}