xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/const-label-addr.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
2*f4a2713aSLionel Sambuc // REQUIRES: asserts
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // CHECK: @a.a = internal global i8* blockaddress(@a, %A)
a()5*f4a2713aSLionel Sambuc int a() {
6*f4a2713aSLionel Sambuc A:;static void* a = &&A;
7*f4a2713aSLionel Sambuc }
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc // PR14005
10*f4a2713aSLionel Sambuc // CHECK: @b.ar = internal global {{.*}} sub (i{{..}} ptrtoint (i8* blockaddress(@b, %l2) to i{{..}}), i{{..}} ptrtoint (i8* blockaddress(@b, %l1) to i{{..}}))
b()11*f4a2713aSLionel Sambuc int b() {
12*f4a2713aSLionel Sambuc   static int ar = &&l2 - &&l1;
13*f4a2713aSLionel Sambuc l1:
14*f4a2713aSLionel Sambuc   return 10;
15*f4a2713aSLionel Sambuc l2:
16*f4a2713aSLionel Sambuc   return 11;
17*f4a2713aSLionel Sambuc }
18