55 lines · c
1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature2// REQUIRES: avr-registered-target3// RUN: %clang_cc1 -triple avr-- -Wno-strict-prototypes -Wno-deprecated-non-prototype -emit-llvm -o - -verify %s | FileCheck %s4// expected-no-diagnostics5 6// Make sure redeclarations of functions as a different type work when functions7// use non-0 address spaces.8 9int g();10 11// CHECK-LABEL: define {{[^@]+}}@bar12// CHECK-SAME: (i16 noundef [[I:%.*]], i16 noundef [[J:%.*]]) addrspace(1) #[[ATTR0:[0-9]+]] {13// CHECK-NEXT: entry:14// CHECK-NEXT: [[I_ADDR:%.*]] = alloca i16, align 115// CHECK-NEXT: [[J_ADDR:%.*]] = alloca i16, align 116// CHECK-NEXT: store i16 [[I]], ptr [[I_ADDR]], align 117// CHECK-NEXT: store i16 [[J]], ptr [[J_ADDR]], align 118// CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr [[I_ADDR]], align 119// CHECK-NEXT: [[TMP1:%.*]] = load i16, ptr [[J_ADDR]], align 120// CHECK-NEXT: [[CALL:%.*]] = call addrspace(1) i16 @g(i16 noundef [[TMP0]], i16 noundef [[TMP1]])21// CHECK-NEXT: ret i16 [[CALL]]22//23int bar(int i, int j) {24 return g(i, j);25}26 27// CHECK-LABEL: define {{[^@]+}}@foo28// CHECK-SAME: (i16 noundef [[I:%.*]]) addrspace(1) #[[ATTR0]] {29// CHECK-NEXT: entry:30// CHECK-NEXT: [[I_ADDR:%.*]] = alloca i16, align 131// CHECK-NEXT: store i16 [[I]], ptr [[I_ADDR]], align 132// CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr [[I_ADDR]], align 133// CHECK-NEXT: [[CALL:%.*]] = call addrspace(1) i16 @g(i16 noundef [[TMP0]])34// CHECK-NEXT: ret i16 [[CALL]]35//36int foo(int i) {37 return g(i);38}39 40// CHECK-LABEL: define {{[^@]+}}@g41// CHECK-SAME: (i16 noundef [[X:%.*]], i16 noundef [[Y:%.*]]) addrspace(1) #[[ATTR0]] {42// CHECK-NEXT: entry:43// CHECK-NEXT: [[X_ADDR:%.*]] = alloca i16, align 144// CHECK-NEXT: [[Y_ADDR:%.*]] = alloca i16, align 145// CHECK-NEXT: store i16 [[X]], ptr [[X_ADDR]], align 146// CHECK-NEXT: store i16 [[Y]], ptr [[Y_ADDR]], align 147// CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr [[X_ADDR]], align 148// CHECK-NEXT: [[TMP1:%.*]] = load i16, ptr [[Y_ADDR]], align 149// CHECK-NEXT: [[ADD:%.*]] = add nsw i16 [[TMP0]], [[TMP1]]50// CHECK-NEXT: ret i16 [[ADD]]51//52int g(int x, int y) {53 return x + y;54}55