; Checks if llvm bitcode defines a struct type before the pointer type,
; even if the struct definintion appears after the pointer type, while
; pnacl bitcode moves the pointer before the struct.
; RUN: llvm-as < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=LLVM
; RUN: llvm-as < %s | pnacl-freeze | pnacl-bcanalyzer -dump-records \
; RUN: | FileCheck %s -check-prefix=PNACL
%typeB = type { i8, %typeA, i32, %typeA }
%typeA = type { i16 }
define %typeB* @foo(%typeB* %a) {
ret %typeB* %a
}
define %typeB* @bar(%typeB* %b) {
ret %typeB* %b
}
define i16 @bam(i16 %a) {
ret i16 %a
}
; Show the ordering llvm uses to order types, which is to expand subtypes
; (including accross pointers) before the type. Expands types for functions
; in order: @foo, @bar, @bam.
; LLVM:
; i8
; LLVM:
; i16
; LLVM:
; %typeA = type { i16 }
; LLVM:
; LLVM:
; i32
; LLVM:
; %typeB = type { i8, %typeA, i32, %typeA }
; LLVM:
; LLVM:
; %typeB*
; LLVM:
; %typeB* (%typeB*)
; LLVM:
; %typeB* (%typeB*)*
; LLVM:
; i16 (i16)
; LLVM:
; i16 (i16)*
; LLVM:
; type of instruction "RET"
; LLVM:
; LLVM:
; Show the ordering pnacl-freeze uses to order types.
; PNACL:
; %typeB*
; PNACL:
; i16
; PNACL:
; type of instruction "RET"
; PNACL:
; %typeA = type { i16 }
; PNACL:
; PNACL:
; %typeB* (%typeB*)
; PNACL:
; %typeB* (%typeB*)*
; PNACL:
; i8
; PNACL:
; i32
; PNACL:
; %typeB = type { i8, %typeA, i32, %typeA }
; PNACL:
; PNACL:
; i16 (i16)
; PNACL:
; i16 (i16)*
; PNACL:
; PNACL: