1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
2 ; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
5 @b = common local_unnamed_addr global i32 0, align 4
6 @a = common local_unnamed_addr global i32 0, align 4
8 define i32 @fn2() local_unnamed_addr {
9 ; CHECK-LABEL: define {{[^@]+}}@fn2() local_unnamed_addr {
10 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr @b, align 4
11 ; CHECK-NEXT: [[TMP2:%.*]] = sext i32 [[TMP1]] to i64
12 ; CHECK-NEXT: [[TMP3:%.*]] = inttoptr i64 [[TMP2]] to ptr
13 ; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, ptr [[TMP3]], i64 -4
14 ; CHECK-NEXT: [[DOTVAL:%.*]] = load i32, ptr [[TMP4]], align 4
15 ; CHECK-NEXT: call fastcc void @fn1(i32 [[DOTVAL]])
16 ; CHECK-NEXT: ret i32 undef
18 %1 = load i32, ptr @b, align 4
19 %2 = sext i32 %1 to i64
20 %3 = inttoptr i64 %2 to ptr
21 call fastcc void @fn1(ptr %3)
25 define internal fastcc void @fn1(ptr nocapture readonly) unnamed_addr {
26 ; CHECK-LABEL: define {{[^@]+}}@fn1
27 ; CHECK-SAME: (i32 [[DOT_4_VAL:%.*]]) unnamed_addr {
28 ; CHECK-NEXT: store i32 [[DOT_4_VAL]], ptr @a, align 4
29 ; CHECK-NEXT: ret void
31 %2 = getelementptr inbounds i32, ptr %0, i64 -1
32 %3 = load i32, ptr %2, align 4
33 store i32 %3, ptr @a, align 4