1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 2; RUN: opt --bpf-check-and-opt-ir -S -mtriple=bpf-pc-linux < %s | FileCheck %s 3 4; Generated from the following C code: 5; 6; #define __uptr __attribute__((address_space(1))) 7; 8; extern int __uptr *magic1(); 9; extern int __uptr *magic2(); 10; 11; void test(long i) { 12; int __uptr *a; 13; 14; if (i > 42) 15; a = magic1(); 16; else 17; a = magic2(); 18; a[5] = 7; 19; } 20; 21; Using the following command: 22; 23; clang --target=bpf -O2 -S -emit-llvm -o t.ll t.c 24 25define void @test(i64 noundef %i) { 26; CHECK: if.end: 27; CHECK-NEXT: [[A_0:%.*]] = phi ptr addrspace(1) 28; CHECK-NEXT: [[A_01:%.*]] = addrspacecast ptr addrspace(1) [[A_0]] to ptr 29; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, ptr [[A_01]], i64 5 30; CHECK-NEXT: store i32 7, ptr [[ARRAYIDX2]], align 4 31; CHECK-NEXT: ret void 32; 33entry: 34 %cmp = icmp sgt i64 %i, 42 35 br i1 %cmp, label %if.then, label %if.else 36 37if.then: ; preds = %entry 38 %call = tail call ptr addrspace(1) @magic1() 39 br label %if.end 40 41if.else: ; preds = %entry 42 %call1 = tail call ptr addrspace(1) @magic2() 43 br label %if.end 44 45if.end: ; preds = %if.else, %if.then 46 %a.0 = phi ptr addrspace(1) [ %call, %if.then ], [ %call1, %if.else ] 47 %arrayidx = getelementptr inbounds i32, ptr addrspace(1) %a.0, i64 5 48 store i32 7, ptr addrspace(1) %arrayidx, align 4 49 ret void 50} 51 52declare ptr addrspace(1) @magic1(...) 53declare ptr addrspace(1) @magic2(...) 54