brintos

brintos / llvm-project-archived public Read only

0
0
Text · 814 B · 32d6728 Raw
20 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 42; RUN: opt -passes=bpf-aspace-simplify -mtriple=bpf-pc-linux -S < %s | FileCheck %s3 4; Check that bpf-aspace-simplify pass removes unnecessary (for BPF)5; address space casts for cast M->N -> GEP -> cast N->M chain.6 7define dso_local ptr addrspace(1) @test (ptr addrspace(1) %p) {8; CHECK-LABEL: define dso_local ptr addrspace(1) @test(9; CHECK-SAME: ptr addrspace(1) [[P:%.*]]) {10; CHECK-NEXT:  entry:11; CHECK-NEXT:    [[B1:%.*]] = getelementptr inbounds i8, ptr addrspace(1) [[P]], i64 812; CHECK-NEXT:    ret ptr addrspace(1) [[B1]]13;14  entry:15  %a = addrspacecast ptr addrspace(1) %p to ptr16  %b = getelementptr inbounds i8, ptr %a, i64 817  %c = addrspacecast ptr %b to ptr addrspace(1)18  ret ptr addrspace(1) %c19}20