xref: /aosp_15_r20/external/llvm/test/Transforms/Inline/align.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -inline -preserve-alignment-assumptions-during-inlining -S < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
3*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-linux-gnu"
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdefine void @hello(float* align 128 nocapture %a, float* nocapture readonly %c) #0 {
6*9880d681SAndroid Build Coastguard Workerentry:
7*9880d681SAndroid Build Coastguard Worker  %0 = load float, float* %c, align 4
8*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds float, float* %a, i64 5
9*9880d681SAndroid Build Coastguard Worker  store float %0, float* %arrayidx, align 4
10*9880d681SAndroid Build Coastguard Worker  ret void
11*9880d681SAndroid Build Coastguard Worker}
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Workerdefine void @foo(float* nocapture %a, float* nocapture readonly %c) #0 {
14*9880d681SAndroid Build Coastguard Workerentry:
15*9880d681SAndroid Build Coastguard Worker  tail call void @hello(float* %a, float* %c)
16*9880d681SAndroid Build Coastguard Worker  %0 = load float, float* %c, align 4
17*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds float, float* %a, i64 7
18*9880d681SAndroid Build Coastguard Worker  store float %0, float* %arrayidx, align 4
19*9880d681SAndroid Build Coastguard Worker  ret void
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; CHECK: define void @foo(float* nocapture %a, float* nocapture readonly %c) #0 {
23*9880d681SAndroid Build Coastguard Worker; CHECK: entry:
24*9880d681SAndroid Build Coastguard Worker; CHECK:   %ptrint = ptrtoint float* %a to i64
25*9880d681SAndroid Build Coastguard Worker; CHECK:   %maskedptr = and i64 %ptrint, 127
26*9880d681SAndroid Build Coastguard Worker; CHECK:   %maskcond = icmp eq i64 %maskedptr, 0
27*9880d681SAndroid Build Coastguard Worker; CHECK:   call void @llvm.assume(i1 %maskcond)
28*9880d681SAndroid Build Coastguard Worker; CHECK:   %0 = load float, float* %c, align 4
29*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx.i = getelementptr inbounds float, float* %a, i64 5
30*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %0, float* %arrayidx.i, align 4
31*9880d681SAndroid Build Coastguard Worker; CHECK:   %1 = load float, float* %c, align 4
32*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx = getelementptr inbounds float, float* %a, i64 7
33*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %1, float* %arrayidx, align 4
34*9880d681SAndroid Build Coastguard Worker; CHECK:   ret void
35*9880d681SAndroid Build Coastguard Worker; CHECK: }
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workerdefine void @fooa(float* nocapture align 128 %a, float* nocapture readonly %c) #0 {
38*9880d681SAndroid Build Coastguard Workerentry:
39*9880d681SAndroid Build Coastguard Worker  tail call void @hello(float* %a, float* %c)
40*9880d681SAndroid Build Coastguard Worker  %0 = load float, float* %c, align 4
41*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds float, float* %a, i64 7
42*9880d681SAndroid Build Coastguard Worker  store float %0, float* %arrayidx, align 4
43*9880d681SAndroid Build Coastguard Worker  ret void
44*9880d681SAndroid Build Coastguard Worker}
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker; CHECK: define void @fooa(float* nocapture align 128 %a, float* nocapture readonly %c) #0 {
47*9880d681SAndroid Build Coastguard Worker; CHECK: entry:
48*9880d681SAndroid Build Coastguard Worker; CHECK:   %0 = load float, float* %c, align 4
49*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx.i = getelementptr inbounds float, float* %a, i64 5
50*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %0, float* %arrayidx.i, align 4
51*9880d681SAndroid Build Coastguard Worker; CHECK:   %1 = load float, float* %c, align 4
52*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx = getelementptr inbounds float, float* %a, i64 7
53*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %1, float* %arrayidx, align 4
54*9880d681SAndroid Build Coastguard Worker; CHECK:   ret void
55*9880d681SAndroid Build Coastguard Worker; CHECK: }
56*9880d681SAndroid Build Coastguard Worker
57*9880d681SAndroid Build Coastguard Workerdefine void @hello2(float* align 128 nocapture %a, float* align 128 nocapture %b, float* nocapture readonly %c) #0 {
58*9880d681SAndroid Build Coastguard Workerentry:
59*9880d681SAndroid Build Coastguard Worker  %0 = load float, float* %c, align 4
60*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds float, float* %a, i64 5
61*9880d681SAndroid Build Coastguard Worker  store float %0, float* %arrayidx, align 4
62*9880d681SAndroid Build Coastguard Worker  %arrayidx1 = getelementptr inbounds float, float* %b, i64 8
63*9880d681SAndroid Build Coastguard Worker  store float %0, float* %arrayidx1, align 4
64*9880d681SAndroid Build Coastguard Worker  ret void
65*9880d681SAndroid Build Coastguard Worker}
66*9880d681SAndroid Build Coastguard Worker
67*9880d681SAndroid Build Coastguard Workerdefine void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
68*9880d681SAndroid Build Coastguard Workerentry:
69*9880d681SAndroid Build Coastguard Worker  tail call void @hello2(float* %a, float* %b, float* %c)
70*9880d681SAndroid Build Coastguard Worker  %0 = load float, float* %c, align 4
71*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds float, float* %a, i64 7
72*9880d681SAndroid Build Coastguard Worker  store float %0, float* %arrayidx, align 4
73*9880d681SAndroid Build Coastguard Worker  ret void
74*9880d681SAndroid Build Coastguard Worker}
75*9880d681SAndroid Build Coastguard Worker
76*9880d681SAndroid Build Coastguard Worker; CHECK: define void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
77*9880d681SAndroid Build Coastguard Worker; CHECK: entry:
78*9880d681SAndroid Build Coastguard Worker; CHECK:   %ptrint = ptrtoint float* %a to i64
79*9880d681SAndroid Build Coastguard Worker; CHECK:   %maskedptr = and i64 %ptrint, 127
80*9880d681SAndroid Build Coastguard Worker; CHECK:   %maskcond = icmp eq i64 %maskedptr, 0
81*9880d681SAndroid Build Coastguard Worker; CHECK:   call void @llvm.assume(i1 %maskcond)
82*9880d681SAndroid Build Coastguard Worker; CHECK:   %ptrint1 = ptrtoint float* %b to i64
83*9880d681SAndroid Build Coastguard Worker; CHECK:   %maskedptr2 = and i64 %ptrint1, 127
84*9880d681SAndroid Build Coastguard Worker; CHECK:   %maskcond3 = icmp eq i64 %maskedptr2, 0
85*9880d681SAndroid Build Coastguard Worker; CHECK:   call void @llvm.assume(i1 %maskcond3)
86*9880d681SAndroid Build Coastguard Worker; CHECK:   %0 = load float, float* %c, align 4
87*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx.i = getelementptr inbounds float, float* %a, i64 5
88*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %0, float* %arrayidx.i, align 4
89*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx1.i = getelementptr inbounds float, float* %b, i64 8
90*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %0, float* %arrayidx1.i, align 4
91*9880d681SAndroid Build Coastguard Worker; CHECK:   %1 = load float, float* %c, align 4
92*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx = getelementptr inbounds float, float* %a, i64 7
93*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %1, float* %arrayidx, align 4
94*9880d681SAndroid Build Coastguard Worker; CHECK:   ret void
95*9880d681SAndroid Build Coastguard Worker; CHECK: }
96*9880d681SAndroid Build Coastguard Worker
97*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind uwtable }
98*9880d681SAndroid Build Coastguard Worker
99