Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame^] | 1 | ; RUN: opt -inline -preserve-alignment-assumptions-during-inlining -S < %s | FileCheck %s |
| 2 | target 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 | target triple = "x86_64-unknown-linux-gnu" |
| 4 | |
| 5 | define void @hello(float* align 128 nocapture %a, float* nocapture readonly %c) #0 { |
| 6 | entry: |
| 7 | %0 = load float, float* %c, align 4 |
| 8 | %arrayidx = getelementptr inbounds float, float* %a, i64 5 |
| 9 | store float %0, float* %arrayidx, align 4 |
| 10 | ret void |
| 11 | } |
| 12 | |
| 13 | define void @foo(float* nocapture %a, float* nocapture readonly %c) #0 { |
| 14 | entry: |
| 15 | tail call void @hello(float* %a, float* %c) |
| 16 | %0 = load float, float* %c, align 4 |
| 17 | %arrayidx = getelementptr inbounds float, float* %a, i64 7 |
| 18 | store float %0, float* %arrayidx, align 4 |
| 19 | ret void |
| 20 | } |
| 21 | |
| 22 | ; CHECK: define void @foo(float* nocapture %a, float* nocapture readonly %c) #0 { |
| 23 | ; CHECK: entry: |
| 24 | ; CHECK: %ptrint = ptrtoint float* %a to i64 |
| 25 | ; CHECK: %maskedptr = and i64 %ptrint, 127 |
| 26 | ; CHECK: %maskcond = icmp eq i64 %maskedptr, 0 |
| 27 | ; CHECK: call void @llvm.assume(i1 %maskcond) |
| 28 | ; CHECK: %0 = load float, float* %c, align 4 |
| 29 | ; CHECK: %arrayidx.i = getelementptr inbounds float, float* %a, i64 5 |
| 30 | ; CHECK: store float %0, float* %arrayidx.i, align 4 |
| 31 | ; CHECK: %1 = load float, float* %c, align 4 |
| 32 | ; CHECK: %arrayidx = getelementptr inbounds float, float* %a, i64 7 |
| 33 | ; CHECK: store float %1, float* %arrayidx, align 4 |
| 34 | ; CHECK: ret void |
| 35 | ; CHECK: } |
| 36 | |
| 37 | define void @fooa(float* nocapture align 128 %a, float* nocapture readonly %c) #0 { |
| 38 | entry: |
| 39 | tail call void @hello(float* %a, float* %c) |
| 40 | %0 = load float, float* %c, align 4 |
| 41 | %arrayidx = getelementptr inbounds float, float* %a, i64 7 |
| 42 | store float %0, float* %arrayidx, align 4 |
| 43 | ret void |
| 44 | } |
| 45 | |
| 46 | ; CHECK: define void @fooa(float* nocapture align 128 %a, float* nocapture readonly %c) #0 { |
| 47 | ; CHECK: entry: |
| 48 | ; CHECK: %0 = load float, float* %c, align 4 |
| 49 | ; CHECK: %arrayidx.i = getelementptr inbounds float, float* %a, i64 5 |
| 50 | ; CHECK: store float %0, float* %arrayidx.i, align 4 |
| 51 | ; CHECK: %1 = load float, float* %c, align 4 |
| 52 | ; CHECK: %arrayidx = getelementptr inbounds float, float* %a, i64 7 |
| 53 | ; CHECK: store float %1, float* %arrayidx, align 4 |
| 54 | ; CHECK: ret void |
| 55 | ; CHECK: } |
| 56 | |
| 57 | define void @hello2(float* align 128 nocapture %a, float* align 128 nocapture %b, float* nocapture readonly %c) #0 { |
| 58 | entry: |
| 59 | %0 = load float, float* %c, align 4 |
| 60 | %arrayidx = getelementptr inbounds float, float* %a, i64 5 |
| 61 | store float %0, float* %arrayidx, align 4 |
| 62 | %arrayidx1 = getelementptr inbounds float, float* %b, i64 8 |
| 63 | store float %0, float* %arrayidx1, align 4 |
| 64 | ret void |
| 65 | } |
| 66 | |
| 67 | define void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 { |
| 68 | entry: |
| 69 | tail call void @hello2(float* %a, float* %b, float* %c) |
| 70 | %0 = load float, float* %c, align 4 |
| 71 | %arrayidx = getelementptr inbounds float, float* %a, i64 7 |
| 72 | store float %0, float* %arrayidx, align 4 |
| 73 | ret void |
| 74 | } |
| 75 | |
| 76 | ; CHECK: define void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 { |
| 77 | ; CHECK: entry: |
| 78 | ; CHECK: %ptrint = ptrtoint float* %a to i64 |
| 79 | ; CHECK: %maskedptr = and i64 %ptrint, 127 |
| 80 | ; CHECK: %maskcond = icmp eq i64 %maskedptr, 0 |
| 81 | ; CHECK: call void @llvm.assume(i1 %maskcond) |
| 82 | ; CHECK: %ptrint1 = ptrtoint float* %b to i64 |
| 83 | ; CHECK: %maskedptr2 = and i64 %ptrint1, 127 |
| 84 | ; CHECK: %maskcond3 = icmp eq i64 %maskedptr2, 0 |
| 85 | ; CHECK: call void @llvm.assume(i1 %maskcond3) |
| 86 | ; CHECK: %0 = load float, float* %c, align 4 |
| 87 | ; CHECK: %arrayidx.i = getelementptr inbounds float, float* %a, i64 5 |
| 88 | ; CHECK: store float %0, float* %arrayidx.i, align 4 |
| 89 | ; CHECK: %arrayidx1.i = getelementptr inbounds float, float* %b, i64 8 |
| 90 | ; CHECK: store float %0, float* %arrayidx1.i, align 4 |
| 91 | ; CHECK: %1 = load float, float* %c, align 4 |
| 92 | ; CHECK: %arrayidx = getelementptr inbounds float, float* %a, i64 7 |
| 93 | ; CHECK: store float %1, float* %arrayidx, align 4 |
| 94 | ; CHECK: ret void |
| 95 | ; CHECK: } |
| 96 | |
| 97 | attributes #0 = { nounwind uwtable } |
| 98 | |