27 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 when bpf-aspace-simplify pass modifies chain5; 'cast M->N -> GEP -> cast N->M' it does not remove GEP,6; when that GEP is used by some other instruction.7 8define dso_local ptr addrspace(1) @test (ptr addrspace(1) %p) {9; CHECK-LABEL: define dso_local ptr addrspace(1) @test(10; CHECK-SAME: ptr addrspace(1) [[P:%.*]]) {11; CHECK-NEXT: entry:12; CHECK-NEXT: [[A:%.*]] = addrspacecast ptr addrspace(1) [[P]] to ptr13; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 814; CHECK-NEXT: [[B1:%.*]] = getelementptr inbounds i8, ptr addrspace(1) [[P]], i64 815; CHECK-NEXT: call void @sink(ptr [[B]])16; CHECK-NEXT: ret ptr addrspace(1) [[B1]]17;18 entry:19 %a = addrspacecast ptr addrspace(1) %p to ptr20 %b = getelementptr inbounds i8, ptr %a, i64 821 %c = addrspacecast ptr %b to ptr addrspace(1)22 call void @sink(ptr %b)23 ret ptr addrspace(1) %c24}25 26declare dso_local void @sink(ptr)27