1; RUN: opt %s -S -o - | FileCheck %s 2 3target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 4target triple = "x86_64-unknown-linux-gnu" 5 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. 13 14%fum = type { %aab, i8, [7 x i8] } 15%aab = type { %aba } 16%aba = type { [8 x i8] } 17%fum.1 = type { %abb, i8, [7 x i8] } 18%abb = type { %abc } 19%abc = type { [4 x i8] } 20 21declare void @foo(%fum*) 22 23; Will be remagled to @"llvm.ssa.copy.s_fum.1s" 24declare %fum.1 @"llvm.ssa.copy.s_fums"(%fum.1) 25 26; Will be remagled to @"llvm.ssa.copy.s_fums" 27declare %fum @"llvm.ssa.copy.s_fum.1s"(%fum) 28 29define 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) 32 ret void 33} 34 35define 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) 38 ret void 39} 40 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] } 47 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 52 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 57 58; CHECK: declare %fum.1 @llvm.ssa.copy.s_fum.1s(%fum.1 returned) 59 60; CHECK: declare %fum @llvm.ssa.copy.s_fums(%fum returned) 61