Skip to content

Commit c9babbc

Browse files
committed
Pre-commit PhaseOrdering/always-inline-alloca-promotion.ll
1 parent a258870 commit c9babbc

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt --Os -S %s -o - | FileCheck %s
3+
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128-Fn32"
4+
target triple = "arm64e-apple-ios19.0.0"
5+
6+
; This test checks if we generate a phi for the <vscale 16 x float> value or we manage
7+
; to promote it during inlining.
8+
9+
; Function Attrs: mustprogress optsize ssp uwtable(sync)
10+
define void @pluto() #0 {
11+
; CHECK-LABEL: define void @pluto(
12+
; CHECK-SAME: ) local_unnamed_addr #[[ATTR0:[0-9]+]] {
13+
; CHECK-NEXT: [[TMP1:%.*]] = load i64, ptr inttoptr (i64 48 to ptr), align 16
14+
; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i64 [[TMP1]], 0
15+
; CHECK-NEXT: [[TMP3:%.*]] = tail call <vscale x 16 x float> @llvm.vector.insert.nxv16f32.nxv4f32(<vscale x 16 x float> zeroinitializer, <vscale x 4 x float> zeroinitializer, i64 0)
16+
; CHECK-NEXT: br label %[[SNORK_EXIT:.*]]
17+
; CHECK: [[SNORK_EXIT]]:
18+
; CHECK-NEXT: [[DOT0:%.*]] = phi <vscale x 16 x float> [ undef, [[TMP0:%.*]] ], [ [[SPEC_SELECT:%.*]], %[[SNORK_EXIT]] ]
19+
; CHECK-NEXT: [[SPEC_SELECT]] = select i1 [[TMP2]], <vscale x 16 x float> [[TMP3]], <vscale x 16 x float> [[DOT0]]
20+
; CHECK-NEXT: [[TMP4:%.*]] = tail call <vscale x 4 x float> @llvm.vector.extract.nxv4f32.nxv16f32(<vscale x 16 x float> [[SPEC_SELECT]], i64 0)
21+
; CHECK-NEXT: tail call void @llvm.aarch64.sme.mopa.nxv4f32(i32 0, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x float> zeroinitializer, <vscale x 4 x float> [[TMP4]])
22+
; CHECK-NEXT: br label %[[SNORK_EXIT]]
23+
;
24+
br label %1
25+
26+
1: ; preds = %1, %0
27+
call void @ham() #5
28+
br label %1
29+
}
30+
31+
; Function Attrs: alwaysinline mustprogress optsize ssp uwtable(sync)
32+
define void @ham() #1 {
33+
; CHECK-LABEL: define void @ham(
34+
; CHECK-SAME: ) local_unnamed_addr #[[ATTR1:[0-9]+]] {
35+
; CHECK-NEXT: [[SNORK_EXIT:.*:]]
36+
; CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr inttoptr (i64 48 to ptr), align 16
37+
; CHECK-NEXT: [[TMP1:%.*]] = icmp sgt i64 [[TMP0]], 0
38+
; CHECK-NEXT: [[TMP2:%.*]] = tail call <vscale x 16 x float> @llvm.vector.insert.nxv16f32.nxv4f32(<vscale x 16 x float> zeroinitializer, <vscale x 4 x float> zeroinitializer, i64 0)
39+
; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[TMP1]], <vscale x 16 x float> [[TMP2]], <vscale x 16 x float> undef
40+
; CHECK-NEXT: [[TMP3:%.*]] = tail call <vscale x 4 x float> @llvm.vector.extract.nxv4f32.nxv16f32(<vscale x 16 x float> [[SPEC_SELECT]], i64 0)
41+
; CHECK-NEXT: tail call void @llvm.aarch64.sme.mopa.nxv4f32(i32 0, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x float> zeroinitializer, <vscale x 4 x float> [[TMP3]])
42+
; CHECK-NEXT: ret void
43+
;
44+
%1 = alloca <vscale x 16 x float>, align 16
45+
%2 = load i64, ptr inttoptr (i64 48 to ptr), align 8
46+
%3 = call i64 @snork(i64 noundef %2, ptr noundef nonnull align 16 %1) #5
47+
%4 = load <vscale x 16 x float>, ptr %1, align 16
48+
%5 = call <vscale x 4 x float> @llvm.vector.extract.nxv4f32.nxv16f32(<vscale x 16 x float> %4, i64 0)
49+
call void @llvm.aarch64.sme.mopa.nxv4f32(i32 0, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x float> zeroinitializer, <vscale x 4 x float> %5)
50+
ret void
51+
}
52+
53+
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
54+
declare <vscale x 16 x float> @llvm.vector.insert.nxv16f32.nxv4f32(<vscale x 16 x float>, <vscale x 4 x float>, i64 immarg) #2
55+
56+
; Function Attrs: alwaysinline mustprogress nounwind optsize ssp uwtable(sync)
57+
define i64 @snork(i64 noundef %0, ptr noundef nonnull align 16 %1) #3 {
58+
; CHECK-LABEL: define noundef i64 @snork(
59+
; CHECK-SAME: i64 noundef [[TMP0:%.*]], ptr noundef nonnull writeonly align 16 captures(none) [[TMP1:%.*]]) local_unnamed_addr #[[ATTR3:[0-9]+]] {
60+
; CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i64 [[TMP0]], 0
61+
; CHECK-NEXT: br i1 [[TMP3]], label %[[BB4:.*]], label %[[BB6:.*]]
62+
; CHECK: [[BB4]]:
63+
; CHECK-NEXT: [[TMP5:%.*]] = tail call <vscale x 16 x float> @llvm.vector.insert.nxv16f32.nxv4f32(<vscale x 16 x float> zeroinitializer, <vscale x 4 x float> zeroinitializer, i64 0)
64+
; CHECK-NEXT: store <vscale x 16 x float> [[TMP5]], ptr [[TMP1]], align 16
65+
; CHECK-NEXT: br label %[[BB6]]
66+
; CHECK: [[BB6]]:
67+
; CHECK-NEXT: ret i64 0
68+
;
69+
%3 = icmp sgt i64 %0, 0
70+
br i1 %3, label %4, label %6
71+
72+
4: ; preds = %2
73+
%5 = call <vscale x 16 x float> @llvm.vector.insert.nxv16f32.nxv4f32(<vscale x 16 x float> zeroinitializer, <vscale x 4 x float> zeroinitializer, i64 0)
74+
store <vscale x 16 x float> %5, ptr %1, align 16
75+
br label %6
76+
77+
6: ; preds = %4, %2
78+
ret i64 0
79+
}
80+
81+
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
82+
declare <vscale x 4 x float> @llvm.vector.extract.nxv4f32.nxv16f32(<vscale x 16 x float>, i64 immarg) #2
83+
84+
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite)
85+
declare void @llvm.aarch64.sme.mopa.nxv4f32(i32 immarg, <vscale x 4 x i1>, <vscale x 4 x i1>, <vscale x 4 x float>, <vscale x 4 x float>) #4
86+
87+
attributes #0 = { mustprogress optsize ssp uwtable(sync) "aarch64_new_za" "aarch64_pstate_sm_enabled" "frame-pointer"="non-leaf" "no-builtin-calloc" "no-builtin-stpcpy" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m4" }
88+
attributes #1 = { alwaysinline mustprogress optsize ssp uwtable(sync) "aarch64_inout_za" "aarch64_pstate_sm_enabled" "frame-pointer"="non-leaf" "no-builtin-calloc" "no-builtin-stpcpy" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m4" }
89+
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
90+
attributes #3 = { alwaysinline mustprogress nounwind optsize ssp uwtable(sync) "aarch64_inout_za" "aarch64_pstate_sm_enabled" "frame-pointer"="non-leaf" "no-builtin-calloc" "no-builtin-stpcpy" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m4" }
91+
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
92+
attributes #5 = { optsize "aarch64_inout_za" "aarch64_pstate_sm_enabled" "no-builtin-calloc" "no-builtin-stpcpy" }

0 commit comments

Comments
 (0)