IR: print value numbers for unnamed function arguments

For consistency with normal instructions and clarity when reading IR,
it's best to print the %0, %1, ... names of function arguments in
definitions.

Also modifies the parser to accept IR in that form for obvious reasons.

llvm-svn: 367755
This commit is contained in:
Tim Northover 2019-08-03 14:28:34 +00:00
parent 95c93d36e6
commit e5745c32fd
49 changed files with 394 additions and 258 deletions

View File

@ -53,6 +53,13 @@ Non-comprehensive list of changes in this release
Changes to the LLVM IR
----------------------
* Unnamed function arguments now get printed with their automatically
generated name (e.g. "i32 %0") in definitions. This may require front-ends
to update their tests; if so there is a script utils/add_argument_names.py
that correctly converted 80-90% of Clang tests. Some manual work will almost
certainly still be needed.
Changes to building LLVM
------------------------

View File

@ -2551,6 +2551,7 @@ bool LLParser::ParseOptionalOperandBundles(
///
bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList,
bool &isVarArg){
unsigned CurValID = 0;
isVarArg = false;
assert(Lex.getKind() == lltok::lparen);
Lex.Lex(); // eat the (.
@ -2575,6 +2576,12 @@ bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList,
if (Lex.getKind() == lltok::LocalVar) {
Name = Lex.getStrVal();
Lex.Lex();
} else if (Lex.getKind() == lltok::LocalVarID) {
if (Lex.getUIntVal() != CurValID)
return Error(TypeLoc, "argument expected to be numbered '%" +
Twine(CurValID) + "'");
++CurValID;
Lex.Lex();
}
if (!FunctionType::isValidArgumentType(ArgTy))
@ -2602,6 +2609,13 @@ bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList,
Name = Lex.getStrVal();
Lex.Lex();
} else {
if (Lex.getKind() == lltok::LocalVarID) {
if (Lex.getUIntVal() != CurValID)
return Error(TypeLoc, "argument expected to be numbered '%" +
Twine(CurValID) + "'");
Lex.Lex();
}
++CurValID;
Name = "";
}

View File

@ -3553,6 +3553,10 @@ void AssemblyWriter::printArgument(const Argument *Arg, AttributeSet Attrs) {
if (Arg->hasName()) {
Out << ' ';
PrintLLVMName(Out, Arg);
} else {
int Slot = Machine.getLocalSlot(Arg);
assert(Slot != -1 && "expect argument in function here");
Out << " %" << Slot;
}
}

View File

@ -38,11 +38,11 @@ $N:
; CHECK-NEXT: ret i32 %4
; CHECK-NEXT: }
define void @test2(i32, i32) {
define void @test2(i32 %0, i32 %1) {
; entry label id still not printed on output
2:
ret void
}
; CHECK-LABEL: define void @test2(i32, i32) {
; CHECK-LABEL: define void @test2(i32 %0, i32 %1) {
; CHECK-NEXT: ret void

View File

@ -1,12 +1,12 @@
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
; CHECK: define void @foo(i32* byval(i32) align 4)
define void @foo(i32* byval(i32) align 4) {
; CHECK: define void @foo(i32* byval(i32) align 4 %0)
define void @foo(i32* byval(i32) align 4 %0) {
ret void
}
; CHECK: define void @bar({ i32*, i8 }* byval({ i32*, i8 }) align 4)
define void @bar({i32*, i8}* byval({i32*, i8}) align 4) {
; CHECK: define void @bar({ i32*, i8 }* byval({ i32*, i8 }) align 4 %0)
define void @bar({i32*, i8}* byval({i32*, i8}) align 4 %0) {
ret void
}

View File

@ -3,7 +3,7 @@
; Check that numbered variables in a nonzero program address space 200 can be used in a call instruction
define i8 @test_unnamed(i8(i32)*, i8(i32) addrspace(42)*) {
define i8 @test_unnamed(i8(i32)*, i8(i32) addrspace(42)* %0) {
; Calls with explicit address spaces are fine:
call addrspace(0) i8 %0(i32 0)
call addrspace(42) i8 %1(i32 0)
@ -14,7 +14,7 @@ define i8 @test_unnamed(i8(i32)*, i8(i32) addrspace(42)*) {
}
; PROGAS42: target datalayout = "P42"
; PROGAS42: define i8 @test_unnamed(i8 (i32)*, i8 (i32) addrspace(42)*) addrspace(42) {
; PROGAS42: define i8 @test_unnamed(i8 (i32)* %0, i8 (i32) addrspace(42)* %1) addrspace(42) {
; PROGAS42-NEXT: %3 = call addrspace(0) i8 %0(i32 0)
; PROGAS42-NEXT: %4 = call addrspace(42) i8 %1(i32 0)
; PROGAS42-NEXT: %5 = call addrspace(42) i8 %1(i32 0)

View File

@ -1,6 +1,6 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; CHECK: define i32 @f(i64 "foo bar", i64, i64, i64 "xyz") {
; CHECK: define i32 @f(i64 "foo bar" %0, i64 %1, i64 %2, i64 "xyz" %3) {
define i32 @f(i64 "foo bar", i64, i64, i64 "xyz") {
ret i32 41
}

View File

@ -0,0 +1,6 @@
; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
; CHECK: error: argument expected to be numbered '%1'
define void @foo(i32 %0, i32 %5) {
ret void
}

View File

@ -0,0 +1,6 @@
; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
; CHECK: error: argument expected to be numbered '%1'
define void @foo(i8 %0, i32 %named, i32 %2) {
ret void
}

View File

@ -0,0 +1,6 @@
; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
; CHECK: error: argument expected to be numbered '%0'
define void @foo(i8 %1) {
ret void
}

View File

@ -3,7 +3,7 @@
; CHECK: ; ModuleID = 'debuginfo.c'
; CHECK-NEXT: source_filename = "debuginfo.c"
; CHECK: define i64 @foo(i64, i64, <10 x i64>) !dbg !20 {
; CHECK: define i64 @foo(i64 %0, i64 %1, <10 x i64> %2) !dbg !20 {
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.declare(metadata i64 0, metadata !27, metadata !DIExpression()), !dbg !32
; CHECK-NEXT: call void @llvm.dbg.declare(metadata i64 0, metadata !28, metadata !DIExpression()), !dbg !32

View File

@ -5,14 +5,14 @@
; The test checks that LLVM does not silently misread attributes of
; older bitcode files.
define void @f1(i8 zeroext)
; CHECK: define void @f1(i8 zeroext)
define void @f1(i8 zeroext %0)
; CHECK: define void @f1(i8 zeroext %0)
{
ret void;
}
define void @f2(i8 signext)
; CHECK: define void @f2(i8 signext)
define void @f2(i8 signext %0)
; CHECK: define void @f2(i8 signext %0)
{
ret void;
}
@ -23,14 +23,14 @@ define void @f3() noreturn
ret void;
}
define void @f4(i8 inreg)
; CHECK: define void @f4(i8 inreg)
define void @f4(i8 inreg %0)
; CHECK: define void @f4(i8 inreg %0)
{
ret void;
}
define void @f5(i8* sret)
; CHECK: define void @f5(i8* sret)
define void @f5(i8* sret %0)
; CHECK: define void @f5(i8* sret %0)
{
ret void;
}
@ -41,20 +41,20 @@ define void @f6() nounwind
ret void;
}
define void @f7(i8* noalias)
; CHECK: define void @f7(i8* noalias)
define void @f7(i8* noalias %0)
; CHECK: define void @f7(i8* noalias %0)
{
ret void;
}
define void @f8(i8* byval)
; CHECK: define void @f8(i8* byval(i8))
define void @f8(i8* byval %0)
; CHECK: define void @f8(i8* byval(i8) %0)
{
ret void;
}
define void @f9(i8* nest)
; CHECK: define void @f9(i8* nest)
define void @f9(i8* nest %0)
; CHECK: define void @f9(i8* nest %0)
{
ret void;
}
@ -101,14 +101,14 @@ define void @f16() sspreq
ret void;
}
define void @f17(i8 align 4)
; CHECK: define void @f17(i8 align 4)
define void @f17(i8 align 4 %0)
; CHECK: define void @f17(i8 align 4 %0)
{
ret void;
}
define void @f18(i8* nocapture)
; CHECK: define void @f18(i8* nocapture)
define void @f18(i8* nocapture %0)
; CHECK: define void @f18(i8* nocapture %0)
{
ret void;
}

View File

@ -2,14 +2,14 @@
; RUN: verify-uselistorder < %s
; PR12696
define void @f1(i8 zeroext)
; CHECK: define void @f1(i8 zeroext)
define void @f1(i8 zeroext %0)
; CHECK: define void @f1(i8 zeroext %0)
{
ret void;
}
define void @f2(i8 signext)
; CHECK: define void @f2(i8 signext)
define void @f2(i8 signext %0)
; CHECK: define void @f2(i8 signext %0)
{
ret void;
}
@ -20,14 +20,14 @@ define void @f3() noreturn
ret void;
}
define void @f4(i8 inreg)
; CHECK: define void @f4(i8 inreg)
define void @f4(i8 inreg %0)
; CHECK: define void @f4(i8 inreg %0)
{
ret void;
}
define void @f5(i8* sret)
; CHECK: define void @f5(i8* sret)
define void @f5(i8* sret %0)
; CHECK: define void @f5(i8* sret %0)
{
ret void;
}
@ -38,20 +38,20 @@ define void @f6() nounwind
ret void;
}
define void @f7(i8* noalias)
; CHECK: define void @f7(i8* noalias)
define void @f7(i8* noalias %0)
; CHECK: define void @f7(i8* noalias %0)
{
ret void;
}
define void @f8(i8* byval)
; CHECK: define void @f8(i8* byval(i8))
define void @f8(i8* byval %0)
; CHECK: define void @f8(i8* byval(i8) %0)
{
ret void;
}
define void @f9(i8* nest)
; CHECK: define void @f9(i8* nest)
define void @f9(i8* nest %0)
; CHECK: define void @f9(i8* nest %0)
{
ret void;
}
@ -98,14 +98,14 @@ define void @f16() sspreq
ret void;
}
define void @f17(i8 align 4)
; CHECK: define void @f17(i8 align 4)
define void @f17(i8 align 4 %0)
; CHECK: define void @f17(i8 align 4 %0)
{
ret void;
}
define void @f18(i8* nocapture)
; CHECK: define void @f18(i8* nocapture)
define void @f18(i8* nocapture %0)
; CHECK: define void @f18(i8* nocapture %0)
{
ret void;
}
@ -214,8 +214,8 @@ define void @f35() optnone noinline
ret void;
}
define void @f36(i8* inalloca) {
; CHECK: define void @f36(i8* inalloca) {
define void @f36(i8* inalloca %0) {
; CHECK: define void @f36(i8* inalloca %0) {
ret void
}
@ -240,8 +240,8 @@ define dereferenceable(18446744073709551606) i8* @f40(i8* dereferenceable(184467
ret i8* %a
}
define void @f41(i8* align 32, double* align 64) {
; CHECK: define void @f41(i8* align 32, double* align 64) {
define void @f41(i8* align 32 %0, double* align 64 %1) {
; CHECK: define void @f41(i8* align 32 %0, double* align 64 %1) {
ret void
}
@ -262,13 +262,13 @@ define void @f44() argmemonly
ret void;
}
; CHECK: define "string_attribute" void @f45(i32 "string_attribute")
define "string_attribute" void @f45(i32 "string_attribute") {
; CHECK: define "string_attribute" void @f45(i32 "string_attribute" %0)
define "string_attribute" void @f45(i32 "string_attribute" %0) {
ret void
}
; CHECK: define "string_attribute_with_value"="value" void @f46(i32 "string_attribute_with_value"="value")
define "string_attribute_with_value"="value" void @f46(i32 "string_attribute_with_value"="value") {
; CHECK: define "string_attribute_with_value"="value" void @f46(i32 "string_attribute_with_value"="value" %0)
define "string_attribute_with_value"="value" void @f46(i32 "string_attribute_with_value"="value" %0) {
ret void
}
@ -287,20 +287,20 @@ define void @f49() inaccessiblemem_or_argmemonly {
ret void
}
; CHECK: define void @f50(i8* swiftself)
define void @f50(i8* swiftself)
; CHECK: define void @f50(i8* swiftself %0)
define void @f50(i8* swiftself %0)
{
ret void;
}
; CHECK: define i32 @f51(i8** swifterror)
define i32 @f51(i8** swifterror)
; CHECK: define i32 @f51(i8** swifterror %0)
define i32 @f51(i8** swifterror %0)
{
ret i32 0
}
; CHECK: define i32 @f52(i32, i8** swifterror)
define i32 @f52(i32, i8** swifterror)
; CHECK: define i32 @f52(i32 %0, i8** swifterror %1)
define i32 @f52(i32 %0, i8** swifterror %1)
{
ret i32 0
}
@ -318,13 +318,13 @@ entry:
ret float 1.0
}
; CHECK: define i8* @f54(i32) #30
define i8* @f54(i32) allocsize(0) {
; CHECK: define i8* @f54(i32 %0) #30
define i8* @f54(i32 %0) allocsize(0) {
ret i8* null
}
; CHECK: define i8* @f55(i32, i32) #31
define i8* @f55(i32, i32) allocsize(0, 1) {
; CHECK: define i8* @f55(i32 %0, i32 %1) #31
define i8* @f55(i32 %0, i32 %1) allocsize(0, 1) {
ret i8* null
}

View File

@ -1,16 +1,16 @@
; RUN: llvm-dis < %s.bc | FileCheck %s
; CHECK: define avr_intrcc void @foo(i8)
define avr_intrcc void @foo(i8) {
; CHECK: define avr_intrcc void @foo(i8 %0)
define avr_intrcc void @foo(i8 %0) {
ret void
}
; CHECK: define avr_signalcc void @bar(i8)
define avr_signalcc void @bar(i8) {
; CHECK: define avr_signalcc void @bar(i8 %0)
define avr_signalcc void @bar(i8 %0) {
ret void
}
; CHECK: define void @baz(i8)
define void @baz(i8) {
; CHECK: define void @baz(i8 %0)
define void @baz(i8 %0) {
ret void
}

View File

@ -6,7 +6,7 @@
; CHECK-LABEL: define private %void_one_out_non_private_arg_i32_1_use @void_one_out_non_private_arg_i32_1_use.body(i32 addrspace(1)* %val) #0 {
; CHECK-NEXT: ret %void_one_out_non_private_arg_i32_1_use zeroinitializer
; CHECK-LABEL: define void @void_one_out_non_private_arg_i32_1_use(i32 addrspace(1)*) #1 {
; CHECK-LABEL: define void @void_one_out_non_private_arg_i32_1_use(i32 addrspace(1)* %0) #1 {
; CHECK-NEXT: %2 = call %void_one_out_non_private_arg_i32_1_use @void_one_out_non_private_arg_i32_1_use.body(i32 addrspace(1)* undef)
; CHECK-NEXT: %3 = extractvalue %void_one_out_non_private_arg_i32_1_use %2, 0
; CHECK-NEXT: store i32 %3, i32 addrspace(1)* %0, align 4
@ -23,7 +23,7 @@ define void @void_one_out_non_private_arg_i32_1_use(i32 addrspace(1)* %val) #0 {
; CHECK-NEXT: %2 = insertvalue %bitcast_pointer_as1 undef, <3 x i32> %1, 0
; CHECK-NEXT: ret %bitcast_pointer_as1 %2
; CHECK-LABEL: define void @bitcast_pointer_as1(<3 x i32> addrspace(1)*) #1 {
; CHECK-LABEL: define void @bitcast_pointer_as1(<3 x i32> addrspace(1)* %0) #1 {
; CHECK-NEXT: %2 = call %bitcast_pointer_as1 @bitcast_pointer_as1.body(<3 x i32> addrspace(1)* undef)
define void @bitcast_pointer_as1(<3 x i32> addrspace(1)* %out) #0 {
%load = load volatile <4 x i32>, <4 x i32> addrspace(1)* undef

View File

@ -153,7 +153,7 @@ define void @void_one_out_arg_i32_1_use_align(i32* align 8 %val) #0 {
; CHECK: ret1:
; CHECK-NEXT: ret %void_one_out_arg_i32_2_use { i32 9 }
; CHECK-LABEL: define void @void_one_out_arg_i32_2_use(i1, i32*) #2 {
; CHECK-LABEL: define void @void_one_out_arg_i32_2_use(i1 %0, i32* %1) #2 {
; CHECK-NEXT: %3 = call %void_one_out_arg_i32_2_use @void_one_out_arg_i32_2_use.body(i1 %0, i32* undef)
; CHECK-NEXT: %4 = extractvalue %void_one_out_arg_i32_2_use %3, 0
; CHECK-NEXT: store i32 %4, i32* %1, align 4
@ -176,7 +176,7 @@ declare void @may.clobber()
; CHECK-NEXT: store i32 0, i32* %val
; CHECK-NEXT: ret %void_one_out_arg_i32_2_stores { i32 1 }
; CHECK-LABEL: define void @void_one_out_arg_i32_2_stores(i32*) #2 {
; CHECK-LABEL: define void @void_one_out_arg_i32_2_stores(i32* %0) #2 {
; CHECK-NEXT: %2 = call %void_one_out_arg_i32_2_stores @void_one_out_arg_i32_2_stores.body(i32* undef)
; CHECK-NEXT: %3 = extractvalue %void_one_out_arg_i32_2_stores %2, 0
; CHECK-NEXT: store i32 %3, i32* %0, align 4
@ -191,7 +191,7 @@ define void @void_one_out_arg_i32_2_stores(i32* %val) #0 {
; CHECK-NEXT: call void @may.clobber()
; CHECK-NEXT: ret %void_one_out_arg_i32_2_stores_clobber { i32 1 }
; CHECK-LABEL: define void @void_one_out_arg_i32_2_stores_clobber(i32*) #2 {
; CHECK-LABEL: define void @void_one_out_arg_i32_2_stores_clobber(i32* %0) #2 {
; CHECK-NEXT: %2 = call %void_one_out_arg_i32_2_stores_clobber @void_one_out_arg_i32_2_stores_clobber.body(i32* undef)
; CHECK-NEXT: %3 = extractvalue %void_one_out_arg_i32_2_stores_clobber %2, 0
; CHECK-NEXT: store i32 %3, i32* %0, align 4
@ -219,7 +219,7 @@ define void @void_one_out_arg_i32_call_may_clobber(i32* %val) #0 {
; CHECK-NEXT: call void @may.clobber()
; CHECK-NEXT: ret %void_one_out_arg_i32_pre_call_may_clobber zeroinitializer
; CHECK-LABEL: @void_one_out_arg_i32_pre_call_may_clobber(i32*) #2 {
; CHECK-LABEL: @void_one_out_arg_i32_pre_call_may_clobber(i32* %0) #2 {
; CHECK-NEXT: %2 = call %void_one_out_arg_i32_pre_call_may_clobber @void_one_out_arg_i32_pre_call_may_clobber.body(i32* undef)
; CHECK-NEXT: %3 = extractvalue %void_one_out_arg_i32_pre_call_may_clobber %2, 0
; CHECK-NEXT: store i32 %3, i32* %0, align 4
@ -278,7 +278,7 @@ ret1:
; CHECK-LABEL: define private %void_one_out_arg_v2i32_1_use @void_one_out_arg_v2i32_1_use.body(<2 x i32>* %val) #0 {
; CHECK-NEXT: ret %void_one_out_arg_v2i32_1_use { <2 x i32> <i32 17, i32 9> }
; CHECK-LABEL: define void @void_one_out_arg_v2i32_1_use(<2 x i32>*) #2 {
; CHECK-LABEL: define void @void_one_out_arg_v2i32_1_use(<2 x i32>* %0) #2 {
; CHECK-NEXT: %2 = call %void_one_out_arg_v2i32_1_use @void_one_out_arg_v2i32_1_use.body(<2 x i32>* undef)
; CHECK-NEXT: %3 = extractvalue %void_one_out_arg_v2i32_1_use %2, 0
; CHECK-NEXT: store <2 x i32> %3, <2 x i32>* %0, align 8
@ -294,7 +294,7 @@ define void @void_one_out_arg_v2i32_1_use(<2 x i32>* %val) #0 {
; CHECK-NEXT: ret %void_one_out_arg_struct_1_use { %struct { i32 9, i8 99, float 4.000000e+00 } }
; Normally this is split into element accesses which we don't handle.
; CHECK-LABEL: define void @void_one_out_arg_struct_1_use(%struct*) #2 {
; CHECK-LABEL: define void @void_one_out_arg_struct_1_use(%struct* %0) #2 {
; CHECK-NEXT: %2 = call %void_one_out_arg_struct_1_use @void_one_out_arg_struct_1_use.body(%struct* undef)
; CHECK-NEXT: %3 = extractvalue %void_one_out_arg_struct_1_use %2, 0
; CHECK-NEXT: store %struct %3, %struct* %0, align 4
@ -307,7 +307,7 @@ define void @void_one_out_arg_struct_1_use(%struct* %out) #0 {
; CHECK-LABEL: define private %i32_one_out_arg_i32_1_use @i32_one_out_arg_i32_1_use.body(i32* %val) #0 {
; CHECK-NEXT: ret %i32_one_out_arg_i32_1_use { i32 9, i32 24 }
; CHECK-LABEL: define i32 @i32_one_out_arg_i32_1_use(i32*) #2 {
; CHECK-LABEL: define i32 @i32_one_out_arg_i32_1_use(i32* %0) #2 {
; CHECK-NEXT: %2 = call %i32_one_out_arg_i32_1_use @i32_one_out_arg_i32_1_use.body(i32* undef)
; CHECK-NEXT: %3 = extractvalue %i32_one_out_arg_i32_1_use %2, 1
; CHECK-NEXT: store i32 %3, i32* %0, align 4
@ -321,7 +321,7 @@ define i32 @i32_one_out_arg_i32_1_use(i32* %val) #0 {
; CHECK-LABEL: define private %unused_different_type @unused_different_type.body(i32* %arg0, float* nocapture %arg1) #0 {
; CHECK-NEXT: ret %unused_different_type { float 4.000000e+00 }
; CHECK-LABEL: define void @unused_different_type(i32*, float* nocapture) #2 {
; CHECK-LABEL: define void @unused_different_type(i32* %0, float* nocapture %1) #2 {
; CHECK-NEXT: %3 = call %unused_different_type @unused_different_type.body(i32* %0, float* undef)
; CHECK-NEXT: %4 = extractvalue %unused_different_type %3, 0
; CHECK-NEXT: store float %4, float* %1, align 4
@ -350,7 +350,7 @@ define void @multiple_same_return_noalias(i32* noalias %out0, i32* noalias %out1
; CHECK-LABEL: define private %multiple_same_return_mayalias @multiple_same_return_mayalias.body(i32* %out0, i32* %out1) #0 {
; CHECK-NEXT: ret %multiple_same_return_mayalias { i32 2, i32 1 }
; CHECK-LABEL: define void @multiple_same_return_mayalias(i32*, i32*) #2 {
; CHECK-LABEL: define void @multiple_same_return_mayalias(i32* %0, i32* %1) #2 {
; CHECK-NEXT: %3 = call %multiple_same_return_mayalias @multiple_same_return_mayalias.body(i32* undef, i32* undef)
; CHECK-NEXT: %4 = extractvalue %multiple_same_return_mayalias %3, 0
; CHECK-NEXT: store i32 %4, i32* %0, align 4
@ -366,7 +366,7 @@ define void @multiple_same_return_mayalias(i32* %out0, i32* %out1) #0 {
; CHECK-LABEL: define private %multiple_same_return_mayalias_order @multiple_same_return_mayalias_order.body(i32* %out0, i32* %out1) #0 {
; CHECK-NEXT: ret %multiple_same_return_mayalias_order { i32 1, i32 2 }
; CHECK-LABEL: define void @multiple_same_return_mayalias_order(i32*, i32*) #2 {
; CHECK-LABEL: define void @multiple_same_return_mayalias_order(i32* %0, i32* %1) #2 {
; CHECK-NEXT: %3 = call %multiple_same_return_mayalias_order @multiple_same_return_mayalias_order.body(i32* undef, i32* undef)
; CHECK-NEXT: %4 = extractvalue %multiple_same_return_mayalias_order %3, 0
; CHECK-NEXT: store i32 %4, i32* %0, align 4
@ -401,7 +401,7 @@ endif:
; CHECK-LABEL: define private %i1_one_out_arg_i32_1_use @i1_one_out_arg_i32_1_use.body(i32* %val) #0 {
; CHECK-NEXT: ret %i1_one_out_arg_i32_1_use { i1 true, i32 24 }
; CHECK-LABEL: define i1 @i1_one_out_arg_i32_1_use(i32*) #2 {
; CHECK-LABEL: define i1 @i1_one_out_arg_i32_1_use(i32* %0) #2 {
; CHECK: %2 = call %i1_one_out_arg_i32_1_use @i1_one_out_arg_i32_1_use.body(i32* undef)
; CHECK: %3 = extractvalue %i1_one_out_arg_i32_1_use %2, 1
; CHECK: store i32 %3, i32* %0, align 4
@ -418,7 +418,7 @@ define i1 @i1_one_out_arg_i32_1_use(i32* %val) #0 {
; CHECK-LABEL: define private %i1_zeroext_one_out_arg_i32_1_use @i1_zeroext_one_out_arg_i32_1_use.body(i32* %val) #0 {
; CHECK-NEXT: ret %i1_zeroext_one_out_arg_i32_1_use { i1 true, i32 24 }
; CHECK-LABEL: define zeroext i1 @i1_zeroext_one_out_arg_i32_1_use(i32*) #2 {
; CHECK-LABEL: define zeroext i1 @i1_zeroext_one_out_arg_i32_1_use(i32* %0) #2 {
; CHECK-NEXT: %2 = call %i1_zeroext_one_out_arg_i32_1_use @i1_zeroext_one_out_arg_i32_1_use.body(i32* undef)
; CHECK-NEXT: %3 = extractvalue %i1_zeroext_one_out_arg_i32_1_use %2, 1
; CHECK-NEXT: store i32 %3, i32* %0, align 4
@ -432,7 +432,7 @@ define zeroext i1 @i1_zeroext_one_out_arg_i32_1_use(i32* %val) #0 {
; CHECK-LABEL: define private %i1_signext_one_out_arg_i32_1_use @i1_signext_one_out_arg_i32_1_use.body(i32* %val) #0 {
; CHECK-NEXT: ret %i1_signext_one_out_arg_i32_1_use { i1 true, i32 24 }
; CHECK-LABEL: define signext i1 @i1_signext_one_out_arg_i32_1_use(i32*) #2 {
; CHECK-LABEL: define signext i1 @i1_signext_one_out_arg_i32_1_use(i32* %0) #2 {
; CHECK-NEXT: %2 = call %i1_signext_one_out_arg_i32_1_use @i1_signext_one_out_arg_i32_1_use.body(i32* undef)
; CHECK-NEXT: %3 = extractvalue %i1_signext_one_out_arg_i32_1_use %2, 1
; CHECK-NEXT: store i32 %3, i32* %0, align 4
@ -446,7 +446,7 @@ define signext i1 @i1_signext_one_out_arg_i32_1_use(i32* %val) #0 {
; CHECK-LABEL: define private %p1i32_noalias_one_out_arg_i32_1_use @p1i32_noalias_one_out_arg_i32_1_use.body(i32* %val) #0 {
; CHECK-NEXT: ret %p1i32_noalias_one_out_arg_i32_1_use { i32 addrspace(1)* null, i32 24 }
; CHECK-LABEL: define noalias i32 addrspace(1)* @p1i32_noalias_one_out_arg_i32_1_use(i32*) #2 {
; CHECK-LABEL: define noalias i32 addrspace(1)* @p1i32_noalias_one_out_arg_i32_1_use(i32* %0) #2 {
; CHECK-NEXT: %2 = call %p1i32_noalias_one_out_arg_i32_1_use @p1i32_noalias_one_out_arg_i32_1_use.body(i32* undef)
; CHECK-NEXT: %3 = extractvalue %p1i32_noalias_one_out_arg_i32_1_use %2, 1
; CHECK-NEXT: store i32 %3, i32* %0, align 4
@ -466,7 +466,7 @@ define void @void_one_out_non_private_arg_i32_1_use(i32 addrspace(1)* %val) #0 {
}
; CHECK-LABEL: define private %func_ptr_type @func_ptr_type.body(void ()** %out) #0 {
; CHECK-LABEL: define void @func_ptr_type(void ()**) #2 {
; CHECK-LABEL: define void @func_ptr_type(void ()** %0) #2 {
; CHECK: %2 = call %func_ptr_type @func_ptr_type.body(void ()** undef)
define void @func_ptr_type(void()** %out) #0 {
%func = load void()*, void()** undef
@ -475,7 +475,7 @@ define void @func_ptr_type(void()** %out) #0 {
}
; CHECK-LABEL: define private %bitcast_func_ptr_type @bitcast_func_ptr_type.body(void ()** %out) #0 {
; CHECK-LABEL: define void @bitcast_func_ptr_type(void ()**) #2 {
; CHECK-LABEL: define void @bitcast_func_ptr_type(void ()** %0) #2 {
define void @bitcast_func_ptr_type(void()** %out) #0 {
%func = load i32()*, i32()** undef
%cast = bitcast void()** %out to i32()**
@ -486,7 +486,7 @@ define void @bitcast_func_ptr_type(void()** %out) #0 {
; CHECK-LABEL: define private %out_arg_small_array @out_arg_small_array.body([4 x i32]* %val) #0 {
; CHECK-NEXT: ret %out_arg_small_array { [4 x i32] [i32 0, i32 1, i32 2, i32 3] }
; CHECK-LABEL: define void @out_arg_small_array([4 x i32]*) #2 {
; CHECK-LABEL: define void @out_arg_small_array([4 x i32]* %0) #2 {
define void @out_arg_small_array([4 x i32]* %val) #0 {
store [4 x i32] [i32 0, i32 1, i32 2, i32 3], [4 x i32]* %val
ret void
@ -510,7 +510,7 @@ define <16 x i32> @num_regs_return_limit(i32* %out, i32 %val) #0 {
}
; CHECK-LABEL: define private %num_regs_reach_limit @num_regs_reach_limit.body(i32* %out, i32 %val) #0 {
; CHECK: define [15 x i32] @num_regs_reach_limit(i32*, i32) #2 {
; CHECK: define [15 x i32] @num_regs_reach_limit(i32* %0, i32 %1) #2 {
; CHECK-NEXT: call %num_regs_reach_limit @num_regs_reach_limit.body(i32* undef, i32 %1)
define [15 x i32] @num_regs_reach_limit(i32* %out, i32 %val) #0 {
%load = load volatile [15 x i32], [15 x i32] addrspace(1)* undef
@ -526,7 +526,7 @@ define [15 x i32] @num_regs_reach_limit(i32* %out, i32 %val) #0 {
; CHECK-NEXT: %3 = insertvalue %num_regs_reach_limit_leftover %2, i32 %val0, 2
; CHECK-NEXT: ret %num_regs_reach_limit_leftover %3
; CHECK-LABEL: define [15 x i32] @num_regs_reach_limit_leftover(i32*, i32*, i32) #2 {
; CHECK-LABEL: define [15 x i32] @num_regs_reach_limit_leftover(i32* %0, i32* %1, i32 %2) #2 {
; CHECK-NEXT: %4 = call %num_regs_reach_limit_leftover @num_regs_reach_limit_leftover.body(i32* undef, i32* undef, i32 %2)
; CHECK-NEXT: %5 = extractvalue %num_regs_reach_limit_leftover %4, 1
; CHECK-NEXT: store i32 %5, i32* %0, align 4
@ -547,7 +547,7 @@ define [15 x i32] @num_regs_reach_limit_leftover(i32* %out0, i32* %out1, i32 %va
; CHECK-NEXT: %1 = insertvalue %preserve_debug_info undef, i32 %arg0, 0, !dbg !11
; CHECK-NEXT: ret %preserve_debug_info %1, !dbg !11
; CHECK-LABEL: define void @preserve_debug_info(i32, i32*) #2 !dbg !6 {
; CHECK-LABEL: define void @preserve_debug_info(i32 %0, i32* %1) #2 !dbg !6 {
; CHECK-NEXT: %3 = call %preserve_debug_info @preserve_debug_info.body(i32 %0, i32* undef){{$}}
; CHECK-NEXT: %4 = extractvalue %preserve_debug_info %3, 0{{$}}
; CHECK-NEXT: store i32 %4, i32* %1, align 4{{$}}
@ -572,7 +572,7 @@ define void @preserve_metadata(i32 %arg0, i32* %val) #0 !kernel_arg_access_qual
; CHECK-NEXT: %2 = insertvalue %bitcast_pointer_v4i32_v3i32 undef, <3 x i32> %1, 0
; CHECK-NEXT: ret %bitcast_pointer_v4i32_v3i32 %2
; CHECK-LABEL: define void @bitcast_pointer_v4i32_v3i32(<3 x i32>*) #2 {
; CHECK-LABEL: define void @bitcast_pointer_v4i32_v3i32(<3 x i32>* %0) #2 {
; CHECK-NEXT: %2 = call %bitcast_pointer_v4i32_v3i32 @bitcast_pointer_v4i32_v3i32.body(<3 x i32>* undef)
; CHECK-NEXT: %3 = extractvalue %bitcast_pointer_v4i32_v3i32 %2, 0
; CHECK-NEXT: store <3 x i32> %3, <3 x i32>* %0, align 16
@ -609,7 +609,7 @@ define void @bitcast_pointer_v4i32_v3f32(<3 x float>* %out) #0 {
; CHECK-NEXT: %2 = insertvalue %bitcast_pointer_i32_f32 undef, float %1, 0
; CHECK-NEXT: ret %bitcast_pointer_i32_f32 %2
; CHECK-LABEL: define void @bitcast_pointer_i32_f32(float*) #2 {
; CHECK-LABEL: define void @bitcast_pointer_i32_f32(float* %0) #2 {
; CHECK-NEXT: %2 = call %bitcast_pointer_i32_f32 @bitcast_pointer_i32_f32.body(float* undef)
; CHECK-NEXT: %3 = extractvalue %bitcast_pointer_i32_f32 %2, 0
; CHECK-NEXT: store float %3, float* %0, align 4
@ -652,7 +652,7 @@ define void @bitcast_pointer_f16_i32(i32* %out) #0 {
; CHECK-NEXT: %3 = insertvalue %bitcast_struct_v3f32_v3f32 undef, %struct.v3f32 %2, 0
; CHECK-NEXT: ret %bitcast_struct_v3f32_v3f32 %3
; CHECK-LABEL: define void @bitcast_struct_v3f32_v3f32(%struct.v3f32*, <3 x float>) #2 {
; CHECK-LABEL: define void @bitcast_struct_v3f32_v3f32(%struct.v3f32* %0, <3 x float> %1) #2 {
; CHECK-NEXT: %3 = call %bitcast_struct_v3f32_v3f32 @bitcast_struct_v3f32_v3f32.body(%struct.v3f32* undef, <3 x float> %1)
; CHECK-NEXT: %4 = extractvalue %bitcast_struct_v3f32_v3f32 %3, 0
; CHECK-NEXT: store %struct.v3f32 %4, %struct.v3f32* %0, align 16
@ -673,7 +673,7 @@ define void @bitcast_struct_v3f32_v3f32(%struct.v3f32* %out, <3 x float> %value)
; CHECK-NEXT: %4 = insertvalue %bitcast_struct_v3f32_v3i32 undef, %struct.v3f32 %3, 0
; CHECK-NEXT: ret %bitcast_struct_v3f32_v3i32 %4
; CHECK-LABEL: define void @bitcast_struct_v3f32_v3i32(%struct.v3f32*, <3 x i32>) #2 {
; CHECK-LABEL: define void @bitcast_struct_v3f32_v3i32(%struct.v3f32* %0, <3 x i32> %1) #2 {
; CHECK-NEXT: %3 = call %bitcast_struct_v3f32_v3i32 @bitcast_struct_v3f32_v3i32.body(%struct.v3f32* undef, <3 x i32> %1)
; CHECK-NEXT: %4 = extractvalue %bitcast_struct_v3f32_v3i32 %3, 0
; CHECK-NEXT: store %struct.v3f32 %4, %struct.v3f32* %0, align 16
@ -690,7 +690,7 @@ define void @bitcast_struct_v3f32_v3i32(%struct.v3f32* %out, <3 x i32> %value) #
; CHECK-NEXT: %2 = insertvalue %bitcast_struct_v4f32_v4f32 undef, %struct.v4f32 %1, 0
; CHECK-NEXT: ret %bitcast_struct_v4f32_v4f32 %2
; CHECK-LABEL: define void @bitcast_struct_v4f32_v4f32(%struct.v4f32*, <4 x float>) #2 {
; CHECK-LABEL: define void @bitcast_struct_v4f32_v4f32(%struct.v4f32* %0, <4 x float> %1) #2 {
; CHECK-NEXT: %3 = call %bitcast_struct_v4f32_v4f32 @bitcast_struct_v4f32_v4f32.body(%struct.v4f32* undef, <4 x float> %1)
define void @bitcast_struct_v4f32_v4f32(%struct.v4f32* %out, <4 x float> %value) #0 {
%cast = bitcast %struct.v4f32* %out to <4 x float>*
@ -699,7 +699,7 @@ define void @bitcast_struct_v4f32_v4f32(%struct.v4f32* %out, <4 x float> %value)
}
; CHECK-LABEL: define private %bitcast_struct_v3f32_v4i32 @bitcast_struct_v3f32_v4i32.body(%struct.v3f32* %out, <4 x i32> %value) #0 {
; CHECK-LABEL: define void @bitcast_struct_v3f32_v4i32(%struct.v3f32*, <4 x i32>) #2 {
; CHECK-LABEL: define void @bitcast_struct_v3f32_v4i32(%struct.v3f32* %0, <4 x i32> %1) #2 {
define void @bitcast_struct_v3f32_v4i32(%struct.v3f32* %out, <4 x i32> %value) #0 {
%cast = bitcast %struct.v3f32* %out to <4 x i32>*
store <4 x i32> %value, <4 x i32>* %cast, align 16
@ -707,7 +707,7 @@ define void @bitcast_struct_v3f32_v4i32(%struct.v3f32* %out, <4 x i32> %value) #
}
; CHECK-LABEL: define private %bitcast_struct_v4f32_v3f32 @bitcast_struct_v4f32_v3f32.body(%struct.v4f32* %out, <3 x float> %value) #0 {
; CHECK-LABEL: define void @bitcast_struct_v4f32_v3f32(%struct.v4f32*, <3 x float>) #2 {
; CHECK-LABEL: define void @bitcast_struct_v4f32_v3f32(%struct.v4f32* %0, <3 x float> %1) #2 {
define void @bitcast_struct_v4f32_v3f32(%struct.v4f32* %out, <3 x float> %value) #0 {
%extractVec = shufflevector <3 x float> %value, <3 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 undef>
%cast = bitcast %struct.v4f32* %out to <4 x float>*
@ -755,7 +755,7 @@ define void @bitcast_struct_i128_v4f32(%struct.i128* %out, <4 x float> %value) #
ret void
}
; CHECK-LABEL: define void @bitcast_struct_i128_v4f32(%struct.i128*, <4 x float>) #2 {
; CHECK-LABEL: define void @bitcast_struct_i128_v4f32(%struct.i128* %0, <4 x float> %1) #2 {
; CHECK-NEXT: %3 = call %bitcast_struct_i128_v4f32 @bitcast_struct_i128_v4f32.body(%struct.i128* undef, <4 x float> %1)
define void @bitcast_array_v4i32_v4f32([4 x i32]* %out, [4 x float] %value) #0 {
%cast = bitcast [4 x i32]* %out to [4 x float]*

View File

@ -14,4 +14,4 @@ unwind:
declare void @g()
declare i32 @__CxxFrameHandler3(...)
; CHECK: define internal i32 @"__ehhandler$f"(i8*, i8*, i8*, i8*){{ .+}} comdat($f) {
; CHECK: define internal i32 @"__ehhandler$f"(i8* %0, i8* %1, i8* %2, i8* %3){{ .+}} comdat($f) {

View File

@ -2,7 +2,7 @@
; RUN: llc < %s | FileCheck %s --check-prefix=ASM
; IR-NOT: define.*__ehhandler
; IR: define available_externally void @foo(void ()*)
; IR: define available_externally void @foo(void ()* %0)
; IR-NOT: define.*__ehhandler
; No code should be emitted.

View File

@ -10,7 +10,7 @@
; CHECK: ret i32 %add
; NONAME: @GlobalValueName
; NONAME: @foo(i32)
; NONAME: @foo(i32 %0)
; NONAME-NOT: somelabel:
; NONAME: %2 = load i32, i32* @GlobalValueName
; NONAME: %3 = add i32 %0, %2

View File

@ -13,7 +13,7 @@ define i32 @functional(i32 %a, i32 %b) {
ret i32 %c
}
; CHECK: define i32 (i32, i32)* @discardg(i32)
; CHECK: define i32 (i32, i32)* @discardg(i32 %0)
; CHECK: %[[CALL:.*]] = call { i32 (i32, i32)*, i16 } @"dfs$g"(i32 %0, i16 0)
; CHECK: %[[XVAL:.*]] = extractvalue { i32 (i32, i32)*, i16 } %[[CALL]], 0
; CHECK: ret {{.*}} %[[XVAL]]
@ -21,7 +21,7 @@ define i32 @functional(i32 %a, i32 %b) {
declare void @custom1(i32 %a, i32 %b)
; CHECK: define linkonce_odr { i32, i16 } @"dfsw$custom2"(i32, i32, i16, i16)
; CHECK: define linkonce_odr { i32, i16 } @"dfsw$custom2"(i32 %0, i32 %1, i16 %2, i16 %3)
; CHECK: %[[LABELRETURN2:.*]] = alloca i16
; CHECK: %[[RV:.*]] = call i32 @__dfsw_custom2
; CHECK: %[[RVSHADOW:.*]] = load i16, i16* %[[LABELRETURN2]]
@ -30,7 +30,7 @@ declare void @custom1(i32 %a, i32 %b)
; CHECK: ret { i32, i16 }
declare i32 @custom2(i32 %a, i32 %b)
; CHECK: define linkonce_odr void @"dfsw$custom3"(i32, i16, i16*, ...)
; CHECK: define linkonce_odr void @"dfsw$custom3"(i32 %0, i16 %1, i16* %2, ...)
; CHECK: call void @__dfsan_vararg_wrapper(i8*
; CHECK: unreachable
declare void @custom3(i32 %a, ...)
@ -78,7 +78,7 @@ define i32 (i32, i32)* @g(i32) {
ret i32 (i32, i32)* @custom2
}
; CHECK: define { i32, i16 } @"dfs$adiscard"(i32, i32, i16, i16)
; CHECK: define { i32, i16 } @"dfs$adiscard"(i32 %0, i32 %1, i16 %2, i16 %3)
; CHECK: %[[CALL:.*]] = call i32 @discard(i32 %0, i32 %1)
; CHECK: %[[IVAL0:.*]] = insertvalue { i32, i16 } undef, i32 %[[CALL]], 0
; CHECK: %[[IVAL1:.*]] = insertvalue { i32, i16 } %[[IVAL0]], i16 0, 1
@ -88,7 +88,7 @@ define i32 (i32, i32)* @g(i32) {
; CHECK: declare void @__dfsw_custom1(i32, i32, i16, i16)
; CHECK: declare i32 @__dfsw_custom2(i32, i32, i16, i16, i16*)
; CHECK-LABEL: define linkonce_odr i32 @"dfst0$customcb"(i32 (i32)*, i32, i16, i16*)
; CHECK-LABEL: define linkonce_odr i32 @"dfst0$customcb"(i32 (i32)* %0, i32 %1, i16 %2, i16* %3)
; CHECK: %[[BC:.*]] = bitcast i32 (i32)* %0 to { i32, i16 } (i32, i16)*
; CHECK: %[[CALL:.*]] = call { i32, i16 } %[[BC]](i32 %1, i16 %2)
; CHECK: %[[XVAL0:.*]] = extractvalue { i32, i16 } %[[CALL]], 0

View File

@ -4,7 +4,7 @@ target triple = "x86_64-unknown-linux-gnu"
declare i32 @g()
; CHECK: define { i32, i16 } @"dfs$f"(i32, i32, i16, i16)
; CHECK: define { i32, i16 } @"dfs$f"(i32 %0, i32 %1, i16 %2, i16 %3)
define i32 @f(i32, i32) {
; CHECK: [[LOCALLABELALLOCA:%.*]] = alloca i16
%i = alloca i32

View File

@ -5,7 +5,7 @@ target triple = "x86_64-unknown-linux-gnu"
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1)
define void @ms(i8* %p, i8 %v) {
; CHECK-LABEL: @"dfs$ms"(i8*, i8, i16, i16)
; CHECK-LABEL: @"dfs$ms"(i8* %0, i8 %1, i16 %2, i16 %3)
; CHECK: call void @__dfsan_set_label(i16 %3, i8* %0, i64 1)
call void @llvm.memset.p0i8.i64(i8* %p, i8 %v, i64 1, i1 1)
ret void

View File

@ -70,7 +70,7 @@ bb11:
; CHECK-DAG: @a23 = alias i32 (i8*), i32 (i8*)* @f1.2{{$}}
; CHECK-DAG: @a24 = alias i16, bitcast (i32 (i8*)* @f1.2 to i16*)
; CHECK: define weak_odr dso_local i32 @f1(i8*) comdat($c1) {
; CHECK: define weak_odr dso_local i32 @f1(i8* %0) comdat($c1) {
; CHECK-NEXT: bb10:
; CHECK-NEXT: br label %bb11{{$}}
; CHECK: bb11:

View File

@ -47,7 +47,7 @@ bb11:
; CHECK-DAG: @a23 = alias i32 (i8*), i32 (i8*)* @f1.2{{$}}
; CHECK-DAG: @a24 = alias i16, bitcast (i32 (i8*)* @f1.2 to i16*)
; CHECK: define weak_odr protected i32 @f1(i8*) comdat($c1) {
; CHECK: define weak_odr protected i32 @f1(i8* %0) comdat($c1) {
; CHECK-NEXT: bb10:
; CHECK-NEXT: br label %bb11{{$}}
; CHECK: bb11:

View File

@ -10,8 +10,8 @@
; Copy from first module is prevailing and converted to weak_odr, copy
; from second module is preempted and converted to available_externally and
; removed from comdat.
; IMPORT1: define weak_odr i32 @f(i8*) unnamed_addr comdat($c1) {
; IMPORT2: define available_externally i32 @f(i8*) unnamed_addr {
; IMPORT1: define weak_odr i32 @f(i8* %0) unnamed_addr comdat($c1) {
; IMPORT2: define available_externally i32 @f(i8* %0) unnamed_addr {
; RUN: llvm-nm -o - < %t1.bc.thinlto.o | FileCheck %s --check-prefix=NM1
; NM1: W f

View File

@ -6,7 +6,7 @@
; RUN: opt -S -argpromotion %s | FileCheck --check-prefix=THIS %s
; RUN: opt -S -globalopt -argpromotion %s | FileCheck --check-prefix=OPT %s
; THIS: define internal x86_thiscallcc void @internalfun(%struct.a* %this, <{ %struct.a
; OPT: define internal fastcc void @internalfun(<{ %struct.a }>*)
; OPT: define internal fastcc void @internalfun(<{ %struct.a }>* %0)
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i386-pc-windows-msvc19.11.0"

View File

@ -18,6 +18,6 @@ entry:
unreachable
}
; CHECK: define internal i32 @foo(i32*)
; CHECK: define internal i32 @foo(i32* %0)
attributes #0 = { naked }

View File

@ -50,7 +50,7 @@ entry:
ret i8* %n
}
; CHECK-LABEL: define private fastcc void @NoopCoro.ResumeDestroy(%NoopCoro.Frame*) {
; CHECK-LABEL: define private fastcc void @NoopCoro.ResumeDestroy(%NoopCoro.Frame* %0) {
; CHECK-NEXT: entry
; CHECK-NEXT: ret void

View File

@ -7,27 +7,27 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; TEST 1
; ATTRIBUTOR: define align 8 i32* @test1(i32* returned align 8)
define i32* @test1(i32* align 8) #0 {
; ATTRIBUTOR: define align 8 i32* @test1(i32* returned align 8 %0)
define i32* @test1(i32* align 8 %0) #0 {
ret i32* %0
}
; TEST 2
; ATTRIBUTOR: define i32* @test2(i32* returned)
define i32* @test2(i32*) #0 {
; ATTRIBUTOR: define i32* @test2(i32* returned %0)
define i32* @test2(i32* %0) #0 {
ret i32* %0
}
; TEST 3
; ATTRIBUTOR: define align 4 i32* @test3(i32* align 8, i32* align 4, i1)
define i32* @test3(i32* align 8, i32* align 4, i1) #0 {
; ATTRIBUTOR: define align 4 i32* @test3(i32* align 8 %0, i32* align 4 %1, i1 %2)
define i32* @test3(i32* align 8 %0, i32* align 4 %1, i1 %2) #0 {
%ret = select i1 %2, i32* %0, i32* %1
ret i32* %ret
}
; TEST 4
; ATTRIBUTOR: define align 32 i32* @test4(i32* align 32, i32* align 32, i1)
define i32* @test4(i32* align 32, i32* align 32, i1) #0 {
; ATTRIBUTOR: define align 32 i32* @test4(i32* align 32 %0, i32* align 32 %1, i1 %2)
define i32* @test4(i32* align 32 %0, i32* align 32 %1, i1 %2) #0 {
%ret = select i1 %2, i32* %0, i32* %1
ret i32* %ret
}
@ -82,8 +82,8 @@ define i32* @test6_2() #0 {
@a2 = common global i8 0, align 16
; Function Attrs: nounwind readnone ssp uwtable
define internal i8* @f1(i8* readnone) local_unnamed_addr #0 {
; ATTRIBUTOR: define internal nonnull align 8 i8* @f1(i8* nonnull readnone align 8)
define internal i8* @f1(i8* readnone %0) local_unnamed_addr #0 {
; ATTRIBUTOR: define internal nonnull align 8 i8* @f1(i8* nonnull readnone align 8 %0)
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
@ -98,8 +98,8 @@ define internal i8* @f1(i8* readnone) local_unnamed_addr #0 {
}
; Function Attrs: nounwind readnone ssp uwtable
define internal i8* @f2(i8* readnone) local_unnamed_addr #0 {
; ATTRIBUTOR: define internal nonnull align 8 i8* @f2(i8* nonnull readnone align 8)
define internal i8* @f2(i8* readnone %0) local_unnamed_addr #0 {
; ATTRIBUTOR: define internal nonnull align 8 i8* @f2(i8* nonnull readnone align 8 %0)
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
@ -120,8 +120,8 @@ define internal i8* @f2(i8* readnone) local_unnamed_addr #0 {
}
; Function Attrs: nounwind readnone ssp uwtable
define internal i8* @f3(i8* readnone) local_unnamed_addr #0 {
; ATTRIBUTOR: define internal nonnull align 8 i8* @f3(i8* nonnull readnone align 16)
define internal i8* @f3(i8* readnone %0) local_unnamed_addr #0 {
; ATTRIBUTOR: define internal nonnull align 8 i8* @f3(i8* nonnull readnone align 16 %0)
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5

View File

@ -3,14 +3,14 @@
; See PR26774
; CHECK-LABEL: define void @bar(i8* readonly) {
; CHECK-LABEL: define void @bar(i8* readonly %0) {
define void @bar(i8* readonly) {
call void @foo(i8* %0)
ret void
}
; CHECK-LABEL: define linkonce_odr void @foo(i8* readonly) {
; CHECK-LABEL: define linkonce_odr void @foo(i8* readonly %0) {
define linkonce_odr void @foo(i8* readonly) {
call void @bar(i8* %0)
ret void

View File

@ -4,16 +4,16 @@
; TEST 1
; take mininimum of return values
;
define i32* @test1(i32* dereferenceable(4), double* dereferenceable(8), i1 zeroext) local_unnamed_addr {
; ATTRIBUTOR: define nonnull dereferenceable(4) i32* @test1(i32* nonnull dereferenceable(4), double* nonnull dereferenceable(8), i1 zeroext)
define i32* @test1(i32* dereferenceable(4) %0, double* dereferenceable(8) %1, i1 zeroext %2) local_unnamed_addr {
; ATTRIBUTOR: define nonnull dereferenceable(4) i32* @test1(i32* nonnull dereferenceable(4) %0, double* nonnull dereferenceable(8) %1, i1 zeroext %2)
%4 = bitcast double* %1 to i32*
%5 = select i1 %2, i32* %0, i32* %4
ret i32* %5
}
; TEST 2
define i32* @test2(i32* dereferenceable_or_null(4), double* dereferenceable(8), i1 zeroext) local_unnamed_addr {
; ATTRIBUTOR: define dereferenceable_or_null(4) i32* @test2(i32* dereferenceable_or_null(4), double* nonnull dereferenceable(8), i1 zeroext)
define i32* @test2(i32* dereferenceable_or_null(4) %0, double* dereferenceable(8) %1, i1 zeroext %2) local_unnamed_addr {
; ATTRIBUTOR: define dereferenceable_or_null(4) i32* @test2(i32* dereferenceable_or_null(4) %0, double* nonnull dereferenceable(8) %1, i1 zeroext %2)
%4 = bitcast double* %1 to i32*
%5 = select i1 %2, i32* %0, i32* %4
ret i32* %5
@ -21,21 +21,21 @@ define i32* @test2(i32* dereferenceable_or_null(4), double* dereferenceable(8),
; TEST 3
; GEP inbounds
define i32* @test3_1(i32* dereferenceable(8)) local_unnamed_addr {
; ATTRIBUTOR: define nonnull dereferenceable(4) i32* @test3_1(i32* nonnull dereferenceable(8))
define i32* @test3_1(i32* dereferenceable(8) %0) local_unnamed_addr {
; ATTRIBUTOR: define nonnull dereferenceable(4) i32* @test3_1(i32* nonnull dereferenceable(8) %0)
%ret = getelementptr inbounds i32, i32* %0, i64 1
ret i32* %ret
}
define i32* @test3_2(i32* dereferenceable_or_null(32)) local_unnamed_addr {
define i32* @test3_2(i32* dereferenceable_or_null(32) %0) local_unnamed_addr {
; FIXME: Argument should be mark dereferenceable because of GEP `inbounds`.
; ATTRIBUTOR: define nonnull dereferenceable(16) i32* @test3_2(i32* dereferenceable_or_null(32))
; ATTRIBUTOR: define nonnull dereferenceable(16) i32* @test3_2(i32* dereferenceable_or_null(32) %0)
%ret = getelementptr inbounds i32, i32* %0, i64 4
ret i32* %ret
}
define i32* @test3_3(i32* dereferenceable(8), i32* dereferenceable(16), i1) local_unnamed_addr {
; ATTRIBUTOR: define nonnull dereferenceable(4) i32* @test3_3(i32* nonnull dereferenceable(8), i32* nonnull dereferenceable(16), i1) local_unnamed_addr
define i32* @test3_3(i32* dereferenceable(8) %0, i32* dereferenceable(16) %1, i1 %2) local_unnamed_addr {
; ATTRIBUTOR: define nonnull dereferenceable(4) i32* @test3_3(i32* nonnull dereferenceable(8) %0, i32* nonnull dereferenceable(16) %1, i1 %2) local_unnamed_addr
%ret1 = getelementptr inbounds i32, i32* %0, i64 1
%ret2 = getelementptr inbounds i32, i32* %1, i64 2
%ret = select i1 %2, i32* %ret1, i32* %ret2
@ -45,8 +45,8 @@ define i32* @test3_3(i32* dereferenceable(8), i32* dereferenceable(16), i1) loca
; TEST 4
; Better than known in IR.
define dereferenceable(4) i32* @test4(i32* dereferenceable(8)) local_unnamed_addr {
; ATTRIBUTOR: define nonnull dereferenceable(8) i32* @test4(i32* nonnull returned dereferenceable(8))
define dereferenceable(4) i32* @test4(i32* dereferenceable(8) %0) local_unnamed_addr {
; ATTRIBUTOR: define nonnull dereferenceable(8) i32* @test4(i32* nonnull returned dereferenceable(8) %0)
ret i32* %0
}

View File

@ -17,7 +17,7 @@ define i32 @volatile_load(i32*) norecurse nounwind uwtable {
}
; CHECK: Function Attrs: nofree norecurse nosync nounwind uwtable willreturn
; CHECK-NEXT: define internal i32 @internal_load(i32* nonnull)
; CHECK-NEXT: define internal i32 @internal_load(i32* nonnull %0)
define internal i32 @internal_load(i32*) norecurse nounwind uwtable {
%2 = load i32, i32* %0, align 4
ret i32 %2

View File

@ -20,6 +20,6 @@ entry:
unreachable
}
; CHECK: define internal i32 @foo(i32*)
; CHECK: define internal i32 @foo(i32* %0)
attributes #0 = { naked }

View File

@ -60,8 +60,8 @@ define i8* @bar() nounwind uwtable {
ret i8* %1
}
; CHECK: define noalias i8* @foo1(i32)
define i8* @foo1(i32) nounwind uwtable {
; CHECK: define noalias i8* @foo1(i32 %0)
define i8* @foo1(i32 %0) nounwind uwtable {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
@ -125,8 +125,8 @@ return:
; TEST 8
; CHECK: define noalias i8* @test8(i32*)
define i8* @test8(i32*) nounwind uwtable {
; CHECK: define noalias i8* @test8(i32* %0)
define i8* @test8(i32* %0) nounwind uwtable {
%2 = tail call noalias i8* @malloc(i64 4)
%3 = icmp ne i32* %0, null
br i1 %3, label %4, label %5

View File

@ -29,11 +29,11 @@ define void @only_return() #0 {
; }
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-NEXT: define void @only_free(i8* nocapture) local_unnamed_addr
; FNATTR-NEXT: define void @only_free(i8* nocapture %0) local_unnamed_addr
; ATTRIBUTOR: Function Attrs: noinline nounwind uwtable
; ATTRIBUTOR-NOT: nofree
; ATTRIBUTOR-NEXT: define void @only_free(i8* nocapture) local_unnamed_addr #1
define void @only_free(i8* nocapture) local_unnamed_addr #0 {
; ATTRIBUTOR-NEXT: define void @only_free(i8* nocapture %0) local_unnamed_addr #1
define void @only_free(i8* nocapture %0) local_unnamed_addr #0 {
tail call void @free(i8* %0) #1
ret void
}
@ -51,22 +51,22 @@ define void @only_free(i8* nocapture) local_unnamed_addr #0 {
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-NEXT: define void @free_in_scc1(i8* nocapture) local_unnamed_addr
; FNATTR-NEXT: define void @free_in_scc1(i8* nocapture %0) local_unnamed_addr
; ATTRIBUTOR: Function Attrs: noinline nounwind uwtable
; ATTRIBUTOR-NOT: nofree
; ATTRIBUTOR-NEXT :define void @free_in_scc1(i8* nocapture) local_unnamed_addr
define void @free_in_scc1(i8* nocapture) local_unnamed_addr #0 {
; ATTRIBUTOR-NEXT :define void @free_in_scc1(i8* nocapture %0) local_unnamed_addr
define void @free_in_scc1(i8* nocapture %0) local_unnamed_addr #0 {
tail call void @free_in_scc2(i8* %0) #1
ret void
}
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-NEXT: define void @free_in_scc2(i8* nocapture) local_unnamed_addr
; FNATTR-NEXT: define void @free_in_scc2(i8* nocapture %0) local_unnamed_addr
; ATTRIBUTOR: Function Attrs: noinline nounwind uwtable
; ATTRIBUTOR-NOT: nofree
; ATTRIBUTOR: define void @free_in_scc2(i8* nocapture) local_unnamed_addr
define void @free_in_scc2(i8* nocapture) local_unnamed_addr #0 {
; ATTRIBUTOR: define void @free_in_scc2(i8* nocapture %0) local_unnamed_addr
define void @free_in_scc2(i8* nocapture %0) local_unnamed_addr #0 {
tail call void @free_in_scc1(i8* %0)
tail call void @free(i8* %0) #1
ret void
@ -109,11 +109,11 @@ define void @mutual_recursion2() #0 {
; }
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-NEXT: define void @_Z9delete_opPc(i8*) local_unnamed_addr
; FNATTR-NEXT: define void @_Z9delete_opPc(i8* %0) local_unnamed_addr
; ATTRIBUTOR: Function Attrs: noinline nounwind uwtable
; ATTRIBUTOR-NOT: nofree
; ATTRIBUTOR-NEXT: define void @_Z9delete_opPc(i8*) local_unnamed_addr #1
define void @_Z9delete_opPc(i8*) local_unnamed_addr #0 {
; ATTRIBUTOR-NEXT: define void @_Z9delete_opPc(i8* %0) local_unnamed_addr #1
define void @_Z9delete_opPc(i8* %0) local_unnamed_addr #0 {
%2 = icmp eq i8* %0, null
br i1 %2, label %4, label %3
@ -129,11 +129,11 @@ define void @_Z9delete_opPc(i8*) local_unnamed_addr #0 {
; TEST 6 (negative case)
; Call realloc
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-NEXT: define noalias i8* @call_realloc(i8* nocapture, i64) local_unnamed_addr
; FNATTR-NEXT: define noalias i8* @call_realloc(i8* nocapture %0, i64 %1) local_unnamed_addr
; ATTRIBUTOR: Function Attrs: noinline nounwind uwtable
; ATTRIBUTOR-NOT: nofree
; ATTRIBUTOR-NEXT: define noalias i8* @call_realloc(i8* nocapture, i64) local_unnamed_addr
define noalias i8* @call_realloc(i8* nocapture, i64) local_unnamed_addr #0 {
; ATTRIBUTOR-NEXT: define noalias i8* @call_realloc(i8* nocapture %0, i64 %1) local_unnamed_addr
define noalias i8* @call_realloc(i8* nocapture %0, i64 %1) local_unnamed_addr #0 {
%ret = tail call i8* @realloc(i8* %0, i64 %1) #2
ret i8* %ret
}
@ -196,7 +196,7 @@ define void @call_both() #0 {
; TEST 10 (positive case)
; Call intrinsic function
; FNATTRS: Function Attrs: noinline readnone speculatable
; FNATTRS-NEXT: declare float @llvm.floor.f32(float)
; FNATTRS-NEXT: declare float @llvm.floor.f32(float %0)
; ATTRIBUTOR: Function Attrs: nounwind readnone speculatable
; ATTRIBUTOR-NEXT: declare float @llvm.floor.f32(float)
declare float @llvm.floor.f32(float)

View File

@ -43,10 +43,10 @@ entry:
; }
; FNATTR: Function Attrs: nofree norecurse nounwind uwtable
; FNATTR-NEXT: define i32 @load_monotonic(i32* nocapture readonly)
; FNATTR-NEXT: define i32 @load_monotonic(i32* nocapture readonly %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nosync nounwind uwtable
; ATTRIBUTOR-NEXT: define i32 @load_monotonic(i32* nocapture readonly)
define i32 @load_monotonic(i32* nocapture readonly) norecurse nounwind uwtable {
; ATTRIBUTOR-NEXT: define i32 @load_monotonic(i32* nocapture readonly %0)
define i32 @load_monotonic(i32* nocapture readonly %0) norecurse nounwind uwtable {
%2 = load atomic i32, i32* %0 monotonic, align 4
ret i32 %2
}
@ -59,10 +59,10 @@ define i32 @load_monotonic(i32* nocapture readonly) norecurse nounwind uwtable {
; }
; FNATTR: Function Attrs: nofree norecurse nounwind uwtable
; FNATTR-NEXT: define void @store_monotonic(i32* nocapture)
; FNATTR-NEXT: define void @store_monotonic(i32* nocapture %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nosync nounwind uwtable
; ATTRIBUTOR-NEXT: define void @store_monotonic(i32* nocapture)
define void @store_monotonic(i32* nocapture) norecurse nounwind uwtable {
; ATTRIBUTOR-NEXT: define void @store_monotonic(i32* nocapture %0)
define void @store_monotonic(i32* nocapture %0) norecurse nounwind uwtable {
store atomic i32 10, i32* %0 monotonic, align 4
ret void
}
@ -75,11 +75,11 @@ define void @store_monotonic(i32* nocapture) norecurse nounwind uwtable {
; }
; FNATTR: Function Attrs: nofree norecurse nounwind uwtable
; FNATTR-NEXT: define i32 @load_acquire(i32* nocapture readonly)
; FNATTR-NEXT: define i32 @load_acquire(i32* nocapture readonly %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
; ATTRIBUTOR-NOT: nosync
; ATTRIBUTOR-NEXT: define i32 @load_acquire(i32* nocapture readonly)
define i32 @load_acquire(i32* nocapture readonly) norecurse nounwind uwtable {
; ATTRIBUTOR-NEXT: define i32 @load_acquire(i32* nocapture readonly %0)
define i32 @load_acquire(i32* nocapture readonly %0) norecurse nounwind uwtable {
%2 = load atomic i32, i32* %0 acquire, align 4
ret i32 %2
}
@ -91,11 +91,11 @@ define i32 @load_acquire(i32* nocapture readonly) norecurse nounwind uwtable {
; }
; FNATTR: Function Attrs: nofree norecurse nounwind uwtable
; FNATTR-NEXT: define void @load_release(i32* nocapture)
; FNATTR-NEXT: define void @load_release(i32* nocapture %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
; ATTRIBUTOR-NOT: nosync
; ATTRIBUTOR-NEXT: define void @load_release(i32* nocapture)
define void @load_release(i32* nocapture) norecurse nounwind uwtable {
; ATTRIBUTOR-NEXT: define void @load_release(i32* nocapture %0)
define void @load_release(i32* nocapture %0) norecurse nounwind uwtable {
store atomic volatile i32 10, i32* %0 release, align 4
ret void
}
@ -103,11 +103,11 @@ define void @load_release(i32* nocapture) norecurse nounwind uwtable {
; TEST 6 - negative volatile, relaxed atomic
; FNATTR: Function Attrs: nofree norecurse nounwind uwtable
; FNATTR-NEXT: define void @load_volatile_release(i32* nocapture)
; FNATTR-NEXT: define void @load_volatile_release(i32* nocapture %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
; ATTRIBUTOR-NOT: nosync
; ATTRIBUTOR-NEXT: define void @load_volatile_release(i32* nocapture)
define void @load_volatile_release(i32* nocapture) norecurse nounwind uwtable {
; ATTRIBUTOR-NEXT: define void @load_volatile_release(i32* nocapture %0)
define void @load_volatile_release(i32* nocapture %0) norecurse nounwind uwtable {
store atomic volatile i32 10, i32* %0 release, align 4
ret void
}
@ -119,11 +119,11 @@ define void @load_volatile_release(i32* nocapture) norecurse nounwind uwtable {
; }
; FNATTR: Function Attrs: nofree norecurse nounwind uwtable
; FNATTR-NEXT: define void @volatile_store(i32*)
; FNATTR-NEXT: define void @volatile_store(i32* %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
; ATTRIBUTOR-NOT: nosync
; ATTRIBUTOR-NEXT: define void @volatile_store(i32*)
define void @volatile_store(i32*) norecurse nounwind uwtable {
; ATTRIBUTOR-NEXT: define void @volatile_store(i32* %0)
define void @volatile_store(i32* %0) norecurse nounwind uwtable {
store volatile i32 14, i32* %0, align 4
ret void
}
@ -136,11 +136,11 @@ define void @volatile_store(i32*) norecurse nounwind uwtable {
; }
; FNATTR: Function Attrs: nofree norecurse nounwind uwtable
; FNATTR-NEXT: define i32 @volatile_load(i32*)
; FNATTR-NEXT: define i32 @volatile_load(i32* %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
; ATTRIBUTOR-NOT: nosync
; ATTRIBUTOR-NEXT: define i32 @volatile_load(i32*)
define i32 @volatile_load(i32*) norecurse nounwind uwtable {
; ATTRIBUTOR-NEXT: define i32 @volatile_load(i32* %0)
define i32 @volatile_load(i32* %0) norecurse nounwind uwtable {
%2 = load volatile i32, i32* %0, align 4
ret i32 %2
}
@ -184,22 +184,22 @@ define void @call_might_sync() nounwind uwtable noinline {
; volatile operation in same scc. Call volatile_load defined in TEST 8.
; FNATTR: Function Attrs: nofree noinline nounwind uwtable
; FNATTR-NEXT: define i32 @scc1(i32*)
; FNATTR-NEXT: define i32 @scc1(i32* %0)
; ATTRIBUTOR: Function Attrs: nofree noinline nounwind uwtable
; ATTRIBUTOR-NOT: nosync
; ATTRIBUTOR-NEXT: define i32 @scc1(i32*)
define i32 @scc1(i32*) noinline nounwind uwtable {
; ATTRIBUTOR-NEXT: define i32 @scc1(i32* %0)
define i32 @scc1(i32* %0) noinline nounwind uwtable {
tail call void @scc2(i32* %0);
%val = tail call i32 @volatile_load(i32* %0);
ret i32 %val;
}
; FNATTR: Function Attrs: nofree noinline nounwind uwtable
; FNATTR-NEXT: define void @scc2(i32*)
; FNATTR-NEXT: define void @scc2(i32* %0)
; ATTRIBUTOR: Function Attrs: nofree noinline nounwind uwtable
; ATTRIBUTOR-NOT: nosync
; ATTRIBUTOR-NEXT: define void @scc2(i32*)
define void @scc2(i32*) noinline nounwind uwtable {
; ATTRIBUTOR-NEXT: define void @scc2(i32* %0)
define void @scc2(i32* %0) noinline nounwind uwtable {
tail call i32 @scc1(i32* %0);
ret void;
}
@ -224,10 +224,10 @@ define void @scc2(i32*) noinline nounwind uwtable {
%"struct.std::__atomic_base" = type { i8 }
; FNATTR: Function Attrs: nofree norecurse nounwind
; FNATTR-NEXT: define void @foo1(i32* nocapture, %"struct.std::atomic"* nocapture)
; FNATTR-NEXT: define void @foo1(i32* nocapture %0, %"struct.std::atomic"* nocapture %1)
; ATTRIBUTOR-NOT: nosync
; ATTRIBUTOR: define void @foo1(i32*, %"struct.std::atomic"*)
define void @foo1(i32*, %"struct.std::atomic"*) {
; ATTRIBUTOR: define void @foo1(i32* %0, %"struct.std::atomic"* %1)
define void @foo1(i32* %0, %"struct.std::atomic"* %1) {
store i32 100, i32* %0, align 4
fence release
%3 = getelementptr inbounds %"struct.std::atomic", %"struct.std::atomic"* %1, i64 0, i32 0, i32 0
@ -236,10 +236,10 @@ define void @foo1(i32*, %"struct.std::atomic"*) {
}
; FNATTR: Function Attrs: nofree norecurse nounwind
; FNATTR-NEXT: define void @bar(i32* nocapture readnone, %"struct.std::atomic"* nocapture readonly)
; FNATTR-NEXT: define void @bar(i32* nocapture readnone %0, %"struct.std::atomic"* nocapture readonly %1)
; ATTRIBUTOR-NOT: nosync
; ATTRIBUTOR: define void @bar(i32*, %"struct.std::atomic"*)
define void @bar(i32 *, %"struct.std::atomic"*) {
; ATTRIBUTOR: define void @bar(i32* %0, %"struct.std::atomic"* %1)
define void @bar(i32* %0, %"struct.std::atomic"* %1) {
%3 = getelementptr inbounds %"struct.std::atomic", %"struct.std::atomic"* %1, i64 0, i32 0, i32 0
br label %4
@ -256,10 +256,10 @@ define void @bar(i32 *, %"struct.std::atomic"*) {
; TEST 13 - Fence syncscope("singlethread") seq_cst
; FNATTR: Function Attrs: nofree norecurse nounwind
; FNATTR-NEXT: define void @foo1_singlethread(i32* nocapture, %"struct.std::atomic"* nocapture)
; FNATTR-NEXT: define void @foo1_singlethread(i32* nocapture %0, %"struct.std::atomic"* nocapture %1)
; ATTRIBUTOR: Function Attrs: nofree nosync
; ATTRIBUTOR: define void @foo1_singlethread(i32*, %"struct.std::atomic"*)
define void @foo1_singlethread(i32*, %"struct.std::atomic"*) {
; ATTRIBUTOR: define void @foo1_singlethread(i32* %0, %"struct.std::atomic"* %1)
define void @foo1_singlethread(i32* %0, %"struct.std::atomic"* %1) {
store i32 100, i32* %0, align 4
fence syncscope("singlethread") release
%3 = getelementptr inbounds %"struct.std::atomic", %"struct.std::atomic"* %1, i64 0, i32 0, i32 0
@ -268,10 +268,10 @@ define void @foo1_singlethread(i32*, %"struct.std::atomic"*) {
}
; FNATTR: Function Attrs: nofree norecurse nounwind
; FNATTR-NEXT: define void @bar_singlethread(i32* nocapture readnone, %"struct.std::atomic"* nocapture readonly)
; FNATTR-NEXT: define void @bar_singlethread(i32* nocapture readnone %0, %"struct.std::atomic"* nocapture readonly %1)
; ATTRIBUTOR: Function Attrs: nofree nosync
; ATTRIBUTOR: define void @bar_singlethread(i32*, %"struct.std::atomic"*)
define void @bar_singlethread(i32 *, %"struct.std::atomic"*) {
; ATTRIBUTOR: define void @bar_singlethread(i32* %0, %"struct.std::atomic"* %1)
define void @bar_singlethread(i32* %0, %"struct.std::atomic"* %1) {
%3 = getelementptr inbounds %"struct.std::atomic", %"struct.std::atomic"* %1, i64 0, i32 0, i32 0
br label %4

View File

@ -50,9 +50,9 @@ define void @call_non_nounwind(){
; return -1;
; }
; CHECK: define i32 @maybe_throw(i1 zeroext)
; ATTRIBUTOR: define i32 @maybe_throw(i1 zeroext)
define i32 @maybe_throw(i1 zeroext) {
; CHECK: define i32 @maybe_throw(i1 zeroext %0)
; ATTRIBUTOR: define i32 @maybe_throw(i1 zeroext %0)
define i32 @maybe_throw(i1 zeroext %0) {
br i1 %0, label %2, label %3
2: ; preds = %1

View File

@ -1,14 +1,14 @@
; RUN: opt < %s -functionattrs -S | FileCheck %s
; RUN: opt < %s -passes=function-attrs -S | FileCheck %s
; CHECK: define void @bar(i8* nocapture readnone)
define void @bar(i8* readonly) {
; CHECK: define void @bar(i8* nocapture readnone %0)
define void @bar(i8* readonly %0) {
call void @foo(i8* %0)
ret void
}
; CHECK: define void @foo(i8* nocapture readnone)
define void @foo(i8* readonly) {
; CHECK: define void @foo(i8* nocapture readnone %0)
define void @foo(i8* readonly %0) {
call void @bar(i8* %0)
ret void
}

View File

@ -26,11 +26,11 @@ define void @only_return() #0 {
; }
; FNATTR: Function Attrs: noinline nounwind readnone uwtable
; FNATTR-NEXT: define i32 @fib(i32)
; FNATTR-NEXT: define i32 @fib(i32 %0)
; FIXME: missing willreturn
; ATTRIBUTOR: Function Attrs: nofree noinline nosync nounwind uwtable
; ATTRIBUTOR-NEXT: define i32 @fib(i32) local_unnamed_addr
define i32 @fib(i32) local_unnamed_addr #0 {
; ATTRIBUTOR-NEXT: define i32 @fib(i32 %0) local_unnamed_addr
define i32 @fib(i32 %0) local_unnamed_addr #0 {
%2 = icmp slt i32 %0, 2
br i1 %2, label %9, label %3
@ -58,11 +58,11 @@ define i32 @fib(i32) local_unnamed_addr #0 {
; FNATTR: Function Attrs: noinline norecurse nounwind readnone uwtable
; FNATTR-NOT: willreturn
; FNATTR-NEXT: define i32 @fact_maybe_not_halt(i32) local_unnamed_addr
; FNATTR-NEXT: define i32 @fact_maybe_not_halt(i32 %0) local_unnamed_addr
; ATTRIBUTOR: Function Attrs: nofree noinline nosync nounwind uwtable
; ATTRIBUTOR-NOT: willreturn
; ATTRIBUTOR-NEXT: define i32 @fact_maybe_not_halt(i32) local_unnamed_addr
define i32 @fact_maybe_not_halt(i32) local_unnamed_addr #0 {
; ATTRIBUTOR-NEXT: define i32 @fact_maybe_not_halt(i32 %0) local_unnamed_addr
define i32 @fact_maybe_not_halt(i32 %0) local_unnamed_addr #0 {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
@ -94,10 +94,10 @@ define i32 @fact_maybe_not_halt(i32) local_unnamed_addr #0 {
; FIXME: missing willreturn
; FNATTR: Function Attrs: noinline norecurse nounwind readnone uwtable
; FNATTR-NEXT: define i32 @fact_loop(i32)
; FNATTR-NEXT: define i32 @fact_loop(i32 %0)
; ATTRIBUTOR: Function Attrs: nofree noinline nosync nounwind uwtable
; ATTRIBUTOR-NEXT: define i32 @fact_loop(i32) local_unnamed_addr
define i32 @fact_loop(i32) local_unnamed_addr #0 {
; ATTRIBUTOR-NEXT: define i32 @fact_loop(i32 %0) local_unnamed_addr
define i32 @fact_loop(i32 %0) local_unnamed_addr #0 {
%2 = icmp slt i32 %0, 1
br i1 %2, label %3, label %5
@ -153,7 +153,7 @@ define void @mutual_recursion2() #0 {
; FNATTR-NEXT: declare void @exit(i32) local_unnamed_addr
; ATTRIBUTOR: Function Attrs: noreturn
; ATTRIBUTOR-NEXT: declare void @exit(i32) local_unnamed_add
declare void @exit(i32) local_unnamed_addr noreturn
declare void @exit(i32 %0) local_unnamed_addr noreturn
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-NOT: willreturn
@ -178,11 +178,11 @@ define void @only_exit() local_unnamed_addr #0 {
; }
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-NOT: willreturn
; FNATTR-NEXT: define void @conditional_exit(i32, i32* nocapture readonly) local_unnamed_addr
; FNATTR-NEXT: define void @conditional_exit(i32 %0, i32* nocapture readonly %1) local_unnamed_addr
; ATTRIBUTOR: Function Attrs: noinline nounwind uwtable
; ATTRIBUTOR-NOT: willreturn
; ATTRIBUTOR-NEXT: define void @conditional_exit(i32, i32* nocapture readonly) local_unnamed_addr
define void @conditional_exit(i32, i32* nocapture readonly) local_unnamed_addr #0 {
; ATTRIBUTOR-NEXT: define void @conditional_exit(i32 %0, i32* nocapture readonly %1) local_unnamed_addr
define void @conditional_exit(i32 %0, i32* nocapture readonly %1) local_unnamed_addr #0 {
%3 = icmp eq i32 %0, 0
br i1 %3, label %5, label %4
@ -207,7 +207,7 @@ define void @conditional_exit(i32, i32* nocapture readonly) local_unnamed_addr #
; Call intrinsic function
; FIXME: missing willreturn
; FNATTRS: Function Attrs: noinline readnone speculatable
; FNATTRS-NEXT: declare float @llvm.floor.f32(float)
; FNATTRS-NEXT: declare float @llvm.floor.f32(float %0)
; ATTRIBUTOR: Function Attrs: nounwind readnone speculatable
; ATTRIBUTOR-NEXT: declare float @llvm.floor.f32(float)
declare float @llvm.floor.f32(float)
@ -335,10 +335,10 @@ declare i32 @__gxx_personality_v0(...)
; FIXME: missing willreturn
; FNATTR: Function Attrs: noinline norecurse nounwind readonly uwtable
; FNATTR-NEXT: define i32 @loop_constant_trip_count(i32* nocapture readonly)
; FNATTR-NEXT: define i32 @loop_constant_trip_count(i32* nocapture readonly %0)
; ATTRIBUTOR: Function Attrs: nofree noinline nosync nounwind uwtable
; ATTRIBUTOR-NEXT: define i32 @loop_constant_trip_count(i32* nocapture readonly)
define i32 @loop_constant_trip_count(i32* nocapture readonly) #0 {
; ATTRIBUTOR-NEXT: define i32 @loop_constant_trip_count(i32* nocapture readonly %0)
define i32 @loop_constant_trip_count(i32* nocapture readonly %0) #0 {
br label %3
; <label>:2: ; preds = %3
@ -368,11 +368,11 @@ define i32 @loop_constant_trip_count(i32* nocapture readonly) #0 {
; }
; FNATTR: Function Attrs: noinline norecurse nounwind readonly uwtable
; FNATTR-NOT: willreturn
; FNATTR-NEXT: define i32 @loop_trip_count_unbound(i32, i32, i32* nocapture readonly, i32) local_unnamed_addr
; FNATTR-NEXT: define i32 @loop_trip_count_unbound(i32 %0, i32 %1, i32* nocapture readonly %2, i32 %3) local_unnamed_addr
; ATTRIBUTOR: Function Attrs: nofree noinline nosync nounwind uwtable
; ATTRIBUTOR-NOT: willreturn
; ATTRIBUTOR-NEXT: define i32 @loop_trip_count_unbound(i32, i32, i32* nocapture readonly, i32) local_unnamed_addr
define i32 @loop_trip_count_unbound(i32, i32, i32* nocapture readonly, i32) local_unnamed_addr #0 {
; ATTRIBUTOR-NEXT: define i32 @loop_trip_count_unbound(i32 %0, i32 %1, i32* nocapture readonly %2, i32 %3) local_unnamed_addr
define i32 @loop_trip_count_unbound(i32 %0, i32 %1, i32* nocapture readonly %2, i32 %3) local_unnamed_addr #0 {
%5 = icmp eq i32 %0, %1
br i1 %5, label %6, label %8
@ -406,11 +406,11 @@ define i32 @loop_trip_count_unbound(i32, i32, i32* nocapture readonly, i32) loca
; FIXME: missing willreturn
; FNATTR: Function Attrs: noinline norecurse nounwind readonly uwtable
; FNATTR-NEXT: define i32 @loop_trip_dec(i32, i32* nocapture readonly)
; FNATTR-NEXT: define i32 @loop_trip_dec(i32 %0, i32* nocapture readonly %1)
; ATTRIBUTOR: Function Attrs: nofree noinline nosync nounwind uwtable
; ATTRIBUTOR-NEXT: define i32 @loop_trip_dec(i32, i32* nocapture readonly) local_unnamed_addr
; ATTRIBUTOR-NEXT: define i32 @loop_trip_dec(i32 %0, i32* nocapture readonly %1) local_unnamed_addr
define i32 @loop_trip_dec(i32, i32* nocapture readonly) local_unnamed_addr #0 {
define i32 @loop_trip_dec(i32 %0, i32* nocapture readonly %1) local_unnamed_addr #0 {
%3 = icmp sgt i32 %0, -1
br i1 %3, label %4, label %14
@ -469,9 +469,9 @@ unreachable_label:
; FIXME: missing willreturn
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-NEXT: define i32 @unreachable_exit_positive2(i32)
; FNATTR-NEXT: define i32 @unreachable_exit_positive2(i32 %0)
; ATTRIBUTOR: Function Attrs: nofree noinline nosync nounwind uwtable
; ATTRIBUTOR-NEXT: define i32 @unreachable_exit_positive2(i32)
; ATTRIBUTOR-NEXT: define i32 @unreachable_exit_positive2(i32 %0)
define i32 @unreachable_exit_positive2(i32) local_unnamed_addr #0 {
%2 = icmp slt i32 %0, 1
br i1 %2, label %3, label %5
@ -538,11 +538,11 @@ declare void @llvm.eh.sjlj.longjmp(i8*)
; FNATTR: Function Attrs: noinline nounwind uwtable
; FNATTR-NOT: willreturn
; FNATTR-NEXT: define void @call_longjmp(i8* nocapture readnone) local_unnamed_addr #3 {
; FNATTR-NEXT: define void @call_longjmp(i8* nocapture readnone %0) local_unnamed_addr #3 {
; ATTRIBUTOR: Function Attrs: noinline nounwind uwtable
; ATTRIBUTOR-NOT: willreturn
; ATTRIBUTOR-NEXT: define void @call_longjmp(i8* nocapture readnone) local_unnamed_addr
define void @call_longjmp(i8* nocapture readnone) local_unnamed_addr #0 {
; ATTRIBUTOR-NEXT: define void @call_longjmp(i8* nocapture readnone %0) local_unnamed_addr
define void @call_longjmp(i8* nocapture readnone %0) local_unnamed_addr #0 {
tail call void @llvm.eh.sjlj.longjmp(i8* %0)
ret void
}

View File

@ -18,6 +18,6 @@ entry:
unreachable
}
; CHECK: define internal i32 @foo(i32*)
; CHECK: define internal i32 @foo(i32* %0)
attributes #0 = { naked }

View File

@ -496,7 +496,7 @@ declare void @fn3(i64)
; merge fully redudant and then we can jump-thread the block with the
; store.
;
; CHECK-LABEL: define i32 @phi_translate_partial_redundant_loads(i32, i32*, i32*
; CHECK-LABEL: define i32 @phi_translate_partial_redundant_loads(i32 %0, i32* %1, i32* %2
; CHECK: merge.thread:
; CHECK: store
; CHECK: br label %left_x

View File

@ -126,10 +126,10 @@ ifend: ; preds = %tailrecurse
ret { i32*, i32 } %d
}
; CHECK: define i32 @hoist_bitreverse(i32)
; CHECK: define i32 @hoist_bitreverse(i32 %0)
; CHECK: bitreverse
; CHECK: br label %header
define i32 @hoist_bitreverse(i32) {
define i32 @hoist_bitreverse(i32 %0) {
br label %header
header:

View File

@ -20,5 +20,5 @@ define linkonce_odr hidden i32 @g(i32 %x, i32 %y) comdat {
}
; CHECK-DAG: define linkonce_odr hidden i32 @f(i32 %x, i32 %y) comdat
; CHECK-DAG: define linkonce_odr hidden i32 @g(i32, i32) comdat
; CHECK-DAG: define linkonce_odr hidden i32 @g(i32 %0, i32 %1) comdat

View File

@ -3,8 +3,8 @@
; Ensure that we do not merge functions that are identical with the
; exception of the order of the incoming blocks to a phi.
; CHECK-LABEL: define linkonce_odr hidden i1 @first(i2)
define linkonce_odr hidden i1 @first(i2) {
; CHECK-LABEL: define linkonce_odr hidden i1 @first(i2 %0)
define linkonce_odr hidden i1 @first(i2 %0) {
entry:
; CHECK: switch i2
switch i2 %0, label %default [
@ -26,8 +26,8 @@ done:
ret i1 %result
}
; CHECK-LABEL: define linkonce_odr hidden i1 @second(i2)
define linkonce_odr hidden i1 @second(i2) {
; CHECK-LABEL: define linkonce_odr hidden i1 @second(i2 %0)
define linkonce_odr hidden i1 @second(i2 %0) {
entry:
; CHECK: switch i2
switch i2 %0, label %default [

View File

@ -2,15 +2,15 @@
; Weak functions too small for merging to be profitable
; CHECK: define weak i32 @foo(i8*, i32)
; CHECK: define weak i32 @foo(i8* %0, i32 %1)
; CHECK-NEXT: ret i32 %1
; CHECK: define weak i32 @bar(i8*, i32)
; CHECK: define weak i32 @bar(i8* %0, i32 %1)
; CHECK-NEXT: ret i32 %1
define weak i32 @foo(i8*, i32) #0 {
define weak i32 @foo(i8* %0, i32 %1) #0 {
ret i32 %1
}
define weak i32 @bar(i8*, i32) #0 {
define weak i32 @bar(i8* %0, i32 %1) #0 {
ret i32 %1
}

View File

@ -148,7 +148,7 @@ define i32 @fn3(i8* %obj) #0 {
}
; CHECK-LABEL: define internal void @branch_funnel(i8*
; CHECK: define hidden void @__typeid_typeid1_0_branch_funnel(i8* nest, ...)
; CHECK: define hidden void @__typeid_typeid1_0_branch_funnel(i8* nest %0, ...)
; CHECK-NEXT: musttail call void (...) @llvm.icall.branch.funnel(i8* %0, i8* bitcast ([1 x i8*]* {{(nonnull )?}}@vt1_1 to i8*), i32 (i8*, i32)* {{(nonnull )?}}@vf1_1, i8* bitcast ([1 x i8*]* {{(nonnull )?}}@vt1_2 to i8*), i32 (i8*, i32)* {{(nonnull )?}}@vf1_2, ...)
declare i1 @llvm.type.test(i8*, metadata)

View File

@ -76,17 +76,17 @@ $vf4 = comdat largest
; CHECK: declare void @vf1(i8*)
declare void @vf1(i8*)
; CHECK: define void @vf2(i8*)
; CHECK: define void @vf2(i8* %0)
define void @vf2(i8*) {
ret void
}
; CHECK: define hidden void @"vf3$merged"(i8*) {
; CHECK: define hidden void @"vf3$merged"(i8* %0) {
define internal void @vf3(i8*) {
ret void
}
; CHECK: define hidden void @"vf4$merged"(i8*) comdat {
; CHECK: define hidden void @"vf4$merged"(i8* %0) comdat {
define internal void @vf4(i8*) comdat {
ret void
}

View File

@ -35,6 +35,17 @@ TEST(AsmWriterTest, DebugPrintDetachedInstruction) {
EXPECT_TRUE(r != std::string::npos);
}
TEST(AsmWriterTest, DebugPrintDetachedArgument) {
LLVMContext Ctx;
auto Ty = Type::getInt32Ty(Ctx);
auto Arg = new Argument(Ty);
std::string S;
raw_string_ostream OS(S);
Arg->print(OS);
EXPECT_EQ(S, "i32 <badref>");
}
TEST(AsmWriterTest, DumpDIExpression) {
LLVMContext Ctx;
uint64_t Ops[] = {

82
utils/add_argument_names.py Executable file
View File

@ -0,0 +1,82 @@
#!/usr/bin/env python3
import re, sys
def fix_string(s):
TYPE = re.compile('\s*(i[0-9]+|float|double|x86_fp80|fp128|ppc_fp128|\[\[.*?\]\]|\[2 x \[\[[A-Z_0-9]+\]\]\]|<.*?>|{.*?}|\[[0-9]+ x .*?\]|%["a-z:A-Z0-9._]+({{.*?}})?|%{{.*?}}|{{.*?}}|\[\[.*?\]\])(\s*(\*|addrspace\(.*?\)|dereferenceable\(.*?\)|byval\(.*?\)|sret|zeroext|inreg|returned|signext|nocapture|align \d+|swiftself|swifterror|readonly|noalias|inalloca|nocapture))*\s*')
counter = 0
if 'i32{{.*}}' in s:
counter = 1
at_pos = s.find('@')
if at_pos == -1:
at_pos = 0
annoying_pos = s.find('{{[^(]+}}')
if annoying_pos != -1:
at_pos = annoying_pos + 9
paren_pos = s.find('(', at_pos)
if paren_pos == -1:
return s
res = s[:paren_pos+1]
s = s[paren_pos+1:]
m = TYPE.match(s)
while m:
res += m.group()
s = s[m.end():]
if s.startswith(',') or s.startswith(')'):
res += f' %{counter}'
counter += 1
next_arg = s.find(',')
if next_arg == -1:
break
res += s[:next_arg+1]
s = s[next_arg+1:]
m = TYPE.match(s)
return res+s
def process_file(contents):
PREFIX = re.compile(r'check-prefix(es)?(=|\s+)([a-zA-Z0-9,]+)')
check_prefixes = ['CHECK']
result = ''
for line in contents.split('\n'):
if 'FileCheck' in line:
m = PREFIX.search(line)
if m:
check_prefixes.extend(m.group(3).split(','))
found_check = False
for prefix in check_prefixes:
if prefix in line:
found_check = True
break
if not found_check or 'define' not in line:
result += line + '\n'
continue
# We have a check for a function definition. Number the args.
line = fix_string(line)
result += line + '\n'
return result
def main():
print(f'Processing {sys.argv[1]}')
f = open(sys.argv[1])
content = f.read()
f.close()
content = process_file(content)
f = open(sys.argv[1], 'w')
f.write(content)
f.close()
if __name__ == '__main__':
main()