xref: /aosp_15_r20/external/llvm/test/Feature/constpointer.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llvm-as < %s | llvm-dis > %t1.ll
2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3*9880d681SAndroid Build Coastguard Worker; RUN: diff %t1.ll %t2.ll
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; This testcase is primarily used for testing that global values can be used as
6*9880d681SAndroid Build Coastguard Worker; constant pointer initializers.  This is tricky because they can be forward
7*9880d681SAndroid Build Coastguard Worker; declared and involves an icky bytecode encoding.  There is no meaningful
8*9880d681SAndroid Build Coastguard Worker; optimization that can be performed on this file, it is just here to test
9*9880d681SAndroid Build Coastguard Worker; assembly and disassembly.
10*9880d681SAndroid Build Coastguard Worker;
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker@t3 = global i32* @t1           ;; Forward reference
14*9880d681SAndroid Build Coastguard Worker@t1 = global i32 4
15*9880d681SAndroid Build Coastguard Worker@t4 = global i32** @t3		 ;; reference to reference
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker@t2 = global i32* @t1
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker@0 = global float * @2                ;; Forward numeric reference
20*9880d681SAndroid Build Coastguard Worker@1 = global float * @2                ;; Duplicate forward numeric reference
21*9880d681SAndroid Build Coastguard Worker@2 = global float 0.0
22*9880d681SAndroid Build Coastguard Worker@3 = global float * @2                ;; Numeric reference
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker@fptr = global void() * @f       ;; Forward ref method defn
26*9880d681SAndroid Build Coastguard Workerdeclare void @f()               ;; External method
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker@sptr1   = global [11x i8]* @somestr		;; Forward ref to a constant
29*9880d681SAndroid Build Coastguard Worker@somestr = constant [11x i8] c"hello world"
30*9880d681SAndroid Build Coastguard Worker@sptr2   = global [11x i8]* @somestr
31*9880d681SAndroid Build Coastguard Worker
32