brintos

brintos / llvm-project-archived public Read only

0
0
Text · 631 B · 55205ae Raw
26 lines · plain
1; RUN: llc -mtriple=bpf -mcpu=v1 < %s | FileCheck %s2;3; Source code:4;   struct t1 { int a; };5;   struct t1 data = { .a = 3 };6;   int foo(void) {7;     return data.a + 20;8;   }9; Compilation flag:10;   clang -target bpf -O2 -S -emit-llvm test.c11 12%struct.t1 = type { i32 }13 14@data = dso_local local_unnamed_addr global %struct.t1 { i32 3 }, align 415 16; Function Attrs: norecurse nounwind readonly17define dso_local i32 @foo() local_unnamed_addr {18entry:19  %0 = load i32, ptr @data, align 420  %add = add nsw i32 %0, 2021; CHECK:   [[REG1:r[0-9]+]] = data ll22; CHECK:   r0 = *(u32 *)([[REG1]] + 0)23; CHECK:   r0 += 2024  ret i32 %add25}26