brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 6d28b07 Raw
54 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 42; RUN: opt --bpf-check-and-opt-ir -S -mtriple=bpf-pc-linux < %s | FileCheck %s3 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;     else17;       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.c24 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 ptr29; CHECK-NEXT:    [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, ptr [[A_01]], i64 530; CHECK-NEXT:    store i32 7, ptr [[ARRAYIDX2]], align 431; CHECK-NEXT:    ret void32;33entry:34  %cmp = icmp sgt i64 %i, 4235  br i1 %cmp, label %if.then, label %if.else36 37if.then:                                          ; preds = %entry38  %call = tail call ptr addrspace(1) @magic1()39  br label %if.end40 41if.else:                                          ; preds = %entry42  %call1 = tail call ptr addrspace(1) @magic2()43  br label %if.end44 45if.end:                                           ; preds = %if.else, %if.then46  %a.0 = phi ptr addrspace(1) [ %call, %if.then ], [ %call1, %if.else ]47  %arrayidx = getelementptr inbounds i32, ptr addrspace(1) %a.0, i64 548  store i32 7, ptr addrspace(1) %arrayidx, align 449  ret void50}51 52declare ptr addrspace(1) @magic1(...)53declare ptr addrspace(1) @magic2(...)54