1 ; RUN: opt %s -S -o - | FileCheck %s
3 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
6 ; Note: this test mimics how the naming could have been after parsing in IR in
7 ; a LLVMContext where some types were already available; but before the
8 ; remangleIntrinsicFunctions has happened:
9 ; The @llvm.ssa.copy intrinsics will have to be remangled.
10 ; In certain cases (as shown here) the remangling can result in a name clash.
11 ; This is also related to the llvm/test/tools/llvm-linker/remangle.ll testcase that checks
12 ; a similar situation in the bitcode reader.
14 %fum = type { %aab, i8, [7 x i8] }
16 %aba = type { [8 x i8] }
17 %fum.1 = type { %abb, i8, [7 x i8] }
19 %abc = type { [4 x i8] }
21 declare void @foo(%fum*)
23 ; Will be remagled to @"llvm.ssa.copy.s_fum.1s"
24 declare %fum.1 @"llvm.ssa.copy.s_fums"(%fum.1)
26 ; Will be remagled to @"llvm.ssa.copy.s_fums"
27 declare %fum @"llvm.ssa.copy.s_fum.1s"(%fum)
29 define void @foo1(%fum %a, %fum.1 %b) {
30 %b.copy = call %fum.1 @"llvm.ssa.copy.s_fums"(%fum.1 %b)
31 %a.copy = call %fum @"llvm.ssa.copy.s_fum.1s"(%fum %a)
35 define void @foo2(%fum.1 %b, %fum %a) {
36 %a.copy = call %fum @"llvm.ssa.copy.s_fum.1s"(%fum %a)
37 %b.copy = call %fum.1 @"llvm.ssa.copy.s_fums"(%fum.1 %b)
41 ; CHECK-DAG: %fum = type { %aab, i8, [7 x i8] }
42 ; CHECK-DAG: %aab = type { %aba }
43 ; CHECK-DAG: %aba = type { [8 x i8] }
44 ; CHECK-DAG: %fum.1 = type { %abb, i8, [7 x i8] }
45 ; CHECK-DAG: %abb = type { %abc }
46 ; CHECK-DAG: %abc = type { [4 x i8] }
48 ; CHECK-LABEL: define void @foo1(%fum %a, %fum.1 %b) {
49 ; CHECK-NEXT: %b.copy = call %fum.1 @llvm.ssa.copy.s_fum.1s(%fum.1 %b)
50 ; CHECK-NEXT: %a.copy = call %fum @llvm.ssa.copy.s_fums(%fum %a)
51 ; CHECK-NEXT: ret void
53 ; CHECK-LABEL: define void @foo2(%fum.1 %b, %fum %a) {
54 ; CHECK-NEXT: %a.copy = call %fum @llvm.ssa.copy.s_fums(%fum %a)
55 ; CHECK-NEXT: %b.copy = call %fum.1 @llvm.ssa.copy.s_fum.1s(%fum.1 %b)
56 ; CHECK-NEXT: ret void
58 ; CHECK: declare %fum.1 @llvm.ssa.copy.s_fum.1s(%fum.1 returned)
60 ; CHECK: declare %fum @llvm.ssa.copy.s_fums(%fum returned)