mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-24 09:29:42 +00:00
Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230794 91177308-0d34-0410-b5e6-96231b3b80d8
41 lines
1.1 KiB
LLVM
41 lines
1.1 KiB
LLVM
; RUN: opt -mergefunc -S < %s | FileCheck %s
|
|
|
|
; This test makes sure that the mergefunc pass, uses extract and insert value
|
|
; to convert the struct result type; as struct types cannot be bitcast.
|
|
|
|
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
|
|
|
|
%kv1 = type { i32*, i32* }
|
|
%kv2 = type { i8*, i8* }
|
|
|
|
declare void @noop()
|
|
|
|
define %kv1 @fn1() {
|
|
; CHECK-LABEL: @fn1(
|
|
%tmp = alloca %kv1
|
|
%v1 = getelementptr %kv1, %kv1* %tmp, i32 0, i32 0
|
|
store i32* null, i32** %v1
|
|
%v2 = getelementptr %kv1, %kv1* %tmp, i32 0, i32 0
|
|
store i32* null, i32** %v2
|
|
call void @noop()
|
|
%v3 = load %kv1, %kv1* %tmp
|
|
ret %kv1 %v3
|
|
}
|
|
|
|
define %kv2 @fn2() {
|
|
; CHECK-LABEL: @fn2(
|
|
; CHECK: %1 = tail call %kv1 @fn1()
|
|
; CHECK: %2 = extractvalue %kv1 %1, 0
|
|
; CHECK: %3 = bitcast i32* %2 to i8*
|
|
; CHECK: %4 = insertvalue %kv2 undef, i8* %3, 0
|
|
%tmp = alloca %kv2
|
|
%v1 = getelementptr %kv2, %kv2* %tmp, i32 0, i32 0
|
|
store i8* null, i8** %v1
|
|
%v2 = getelementptr %kv2, %kv2* %tmp, i32 0, i32 0
|
|
store i8* null, i8** %v2
|
|
call void @noop()
|
|
|
|
%v3 = load %kv2, %kv2* %tmp
|
|
ret %kv2 %v3
|
|
}
|