2015-10-08 20:52:40 +02:00
|
|
|
; RUN: llc < %s -march=bpf | FileCheck %s
|
|
|
|
|
|
|
|
%struct.bpf_map_def = type { i32, i32, i32, i32 }
|
|
|
|
%struct.__sk_buff = type opaque
|
|
|
|
%struct.routing_key_2 = type { [6 x i8] }
|
|
|
|
|
|
|
|
@routing = global %struct.bpf_map_def { i32 1, i32 6, i32 12, i32 1024 }, section "maps", align 4
|
|
|
|
@routing_miss_0 = global %struct.bpf_map_def { i32 1, i32 1, i32 12, i32 1 }, section "maps", align 4
|
|
|
|
@test1 = global %struct.bpf_map_def { i32 2, i32 4, i32 8, i32 1024 }, section "maps", align 4
|
|
|
|
@test1_miss_4 = global %struct.bpf_map_def { i32 2, i32 1, i32 8, i32 1 }, section "maps", align 4
|
|
|
|
@_license = global [4 x i8] c"GPL\00", section "license", align 1
|
|
|
|
@llvm.used = appending global [6 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @_license, i32 0, i32 0), i8* bitcast (i32 (%struct.__sk_buff*)* @ebpf_filter to i8*), i8* bitcast (%struct.bpf_map_def* @routing to i8*), i8* bitcast (%struct.bpf_map_def* @routing_miss_0 to i8*), i8* bitcast (%struct.bpf_map_def* @test1 to i8*), i8* bitcast (%struct.bpf_map_def* @test1_miss_4 to i8*)], section "llvm.metadata"
|
|
|
|
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
|
|
define i32 @ebpf_filter(%struct.__sk_buff* nocapture readnone %ebpf_packet) #0 section "socket1" {
|
In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.
Retrying after fixing after removing load-store factoring through
token factors in favor of improved token factor operand pruning
Simplify Consecutive Merge Store Candidate Search
Now that address aliasing is much less conservative, push through
simplified store merging search which only checks for parallel stores
through the chain subgraph. This is cleaner as the separation of
non-interfering loads/stores from the store-merging logic.
Whem merging stores, search up the chain through a single load, and
finds all possible stores by looking down from through a load and a
TokenFactor to all stores visited. This improves the quality of the
output SelectionDAG and generally the output CodeGen (with some
exceptions).
Additional Minor Changes:
1. Finishes removing unused AliasLoad code
2. Unifies the the chain aggregation in the merged stores across
code paths
3. Re-add the Store node to the worklist after calling
SimplifyDemandedBits.
4. Increase GatherAllAliasesMaxDepth from 6 to 18. That number is
arbitrary, but seemed sufficient to not cause regressions in
tests.
This finishes the change Matt Arsenault started in r246307 and
jyknight's original patch.
Many tests required some changes as memory operations are now
reorderable. Some tests relying on the order were changed to use
volatile memory operations
Noteworthy tests:
CodeGen/AArch64/argument-blocks.ll -
It's not entirely clear what the test_varargs_stackalign test is
supposed to be asserting, but the new code looks right.
CodeGen/AArch64/arm64-memset-inline.lli -
CodeGen/AArch64/arm64-stur.ll -
CodeGen/ARM/memset-inline.ll -
The backend now generates *worse* code due to store merging
succeeding, as we do do a 16-byte constant-zero store efficiently.
CodeGen/AArch64/merge-store.ll -
Improved, but there still seems to be an extraneous vector insert
from an element to itself?
CodeGen/PowerPC/ppc64-align-long-double.ll -
Worse code emitted in this case, due to the improved store->load
forwarding.
CodeGen/X86/dag-merge-fast-accesses.ll -
CodeGen/X86/MergeConsecutiveStores.ll -
CodeGen/X86/stores-merging.ll -
CodeGen/Mips/load-store-left-right.ll -
Restored correct merging of non-aligned stores
CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll -
Improved. Correctly merges buffer_store_dword calls
CodeGen/AMDGPU/si-triv-disjoint-mem-access.ll -
Improved. Sidesteps loading a stored value and
merges two stores
CodeGen/X86/pr18023.ll -
This test has been removed, as it was asserting incorrect
behavior. Non-volatile stores *CAN* be moved past volatile loads,
and now are.
CodeGen/X86/vector-idiv.ll -
CodeGen/X86/vector-lzcnt-128.ll -
It's basically impossible to tell what these tests are actually
testing. But, looks like the code got better due to the memory
operations being recognized as non-aliasing.
CodeGen/X86/win32-eh.ll -
Both loads of the securitycookie are now merged.
Reviewers: arsenm, hfinkel, tstellarAMD, jyknight, nhaehnle
Subscribers: wdng, nhaehnle, nemanjai, arsenm, weimingz, niravd, RKSimon, aemerson, qcolombet, dsanders, resistor, tstellarAMD, t.p.northover, spatel
Differential Revision: https://reviews.llvm.org/D14834
llvm-svn: 289659
2016-12-14 16:44:26 +01:00
|
|
|
; CHECK: r2 = r10
|
|
|
|
; CHECK: r2 += -2
|
|
|
|
; CHECK: r1 = 0
|
|
|
|
; CHECK: *(u16 *)(r2 + 6) = r1
|
|
|
|
; CHECK: *(u16 *)(r2 + 4) = r1
|
|
|
|
; CHECK: *(u16 *)(r2 + 2) = r1
|
|
|
|
; CHECK: r2 = 6
|
|
|
|
; CHECK: *(u8 *)(r10 - 7) = r2
|
|
|
|
; CHECK: r2 = 5
|
|
|
|
; CHECK: *(u8 *)(r10 - 8) = r2
|
|
|
|
; CHECK: r2 = 7
|
|
|
|
; CHECK: *(u8 *)(r10 - 6) = r2
|
|
|
|
; CHECK: r2 = 8
|
|
|
|
; CHECK: *(u8 *)(r10 - 5) = r2
|
|
|
|
; CHECK: r2 = 9
|
|
|
|
; CHECK: *(u8 *)(r10 - 4) = r2
|
|
|
|
; CHECK: r2 = 10
|
|
|
|
; CHECK: *(u8 *)(r10 - 3) = r2
|
|
|
|
; CHECK: *(u16 *)(r10 + 24) = r1
|
|
|
|
; CHECK: *(u16 *)(r10 + 22) = r1
|
|
|
|
; CHECK: *(u16 *)(r10 + 20) = r1
|
|
|
|
; CHECK: *(u16 *)(r10 + 18) = r1
|
|
|
|
; CHECK: *(u16 *)(r10 + 16) = r1
|
|
|
|
; CHECK: *(u16 *)(r10 + 14) = r1
|
|
|
|
; CHECK: *(u16 *)(r10 + 12) = r1
|
|
|
|
; CHECK: *(u16 *)(r10 + 10) = r1
|
|
|
|
; CHECK: *(u16 *)(r10 + 8) = r1
|
|
|
|
; CHECK: *(u16 *)(r10 + 6) = r1
|
|
|
|
; CHECK: *(u16 *)(r10 - 2) = r1
|
|
|
|
; CHECK: *(u16 *)(r10 + 26) = r1
|
|
|
|
; CHECK: r2 = r10
|
|
|
|
; CHECK: r2 += -8
|
|
|
|
; CHECK: r1 = <MCOperand Expr:(routing)>ll
|
|
|
|
; CHECK: call bpf_map_lookup_elem
|
|
|
|
; CHECK: exit
|
2015-10-08 20:52:40 +02:00
|
|
|
%key = alloca %struct.routing_key_2, align 1
|
|
|
|
%1 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 0
|
|
|
|
store i8 5, i8* %1, align 1
|
|
|
|
%2 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 1
|
|
|
|
store i8 6, i8* %2, align 1
|
|
|
|
%3 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 2
|
|
|
|
store i8 7, i8* %3, align 1
|
|
|
|
%4 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 3
|
|
|
|
store i8 8, i8* %4, align 1
|
|
|
|
%5 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 4
|
|
|
|
store i8 9, i8* %5, align 1
|
|
|
|
%6 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 5
|
|
|
|
store i8 10, i8* %6, align 1
|
|
|
|
%7 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 1, i32 0, i64 0
|
|
|
|
call void @llvm.memset.p0i8.i64(i8* %7, i8 0, i64 30, i32 1, i1 false)
|
|
|
|
%8 = call i32 (%struct.bpf_map_def*, %struct.routing_key_2*, ...) bitcast (i32 (...)* @bpf_map_lookup_elem to i32 (%struct.bpf_map_def*, %struct.routing_key_2*, ...)*)(%struct.bpf_map_def* nonnull @routing, %struct.routing_key_2* nonnull %key) #3
|
|
|
|
ret i32 undef
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: nounwind argmemonly
|
|
|
|
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #1
|
|
|
|
|
|
|
|
declare i32 @bpf_map_lookup_elem(...) #2
|