head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC4:1.1.1.10
	netbsd-11-0-RC3:1.1.1.10
	netbsd-11-0-RC2:1.1.1.10
	netbsd-11-0-RC1:1.1.1.10
	perseant-exfatfs-base-20250801:1.1.1.10
	netbsd-11:1.1.1.10.0.10
	netbsd-11-base:1.1.1.10
	netbsd-10-1-RELEASE:1.1.1.10
	perseant-exfatfs-base-20240630:1.1.1.10
	perseant-exfatfs:1.1.1.10.0.8
	perseant-exfatfs-base:1.1.1.10
	netbsd-8-3-RELEASE:1.1.1.7
	netbsd-9-4-RELEASE:1.1.1.9
	netbsd-10-0-RELEASE:1.1.1.10
	netbsd-10-0-RC6:1.1.1.10
	netbsd-10-0-RC5:1.1.1.10
	netbsd-10-0-RC4:1.1.1.10
	netbsd-10-0-RC3:1.1.1.10
	netbsd-10-0-RC2:1.1.1.10
	netbsd-10-0-RC1:1.1.1.10
	netbsd-10:1.1.1.10.0.6
	netbsd-10-base:1.1.1.10
	netbsd-9-3-RELEASE:1.1.1.9
	cjep_sun2x:1.1.1.10.0.4
	cjep_sun2x-base:1.1.1.10
	cjep_staticlib_x-base1:1.1.1.10
	netbsd-9-2-RELEASE:1.1.1.9
	cjep_staticlib_x:1.1.1.10.0.2
	cjep_staticlib_x-base:1.1.1.10
	netbsd-9-1-RELEASE:1.1.1.9
	phil-wifi-20200421:1.1.1.10
	phil-wifi-20200411:1.1.1.10
	phil-wifi-20200406:1.1.1.10
	netbsd-8-2-RELEASE:1.1.1.7
	netbsd-9-0-RELEASE:1.1.1.9
	netbsd-9-0-RC2:1.1.1.9
	netbsd-9-0-RC1:1.1.1.9
	netbsd-9:1.1.1.9.0.2
	netbsd-9-base:1.1.1.9
	phil-wifi-20190609:1.1.1.9
	netbsd-8-1-RELEASE:1.1.1.7
	netbsd-8-1-RC1:1.1.1.7
	pgoyette-compat-merge-20190127:1.1.1.8.2.1
	pgoyette-compat-20190127:1.1.1.9
	pgoyette-compat-20190118:1.1.1.9
	pgoyette-compat-1226:1.1.1.9
	pgoyette-compat-1126:1.1.1.9
	pgoyette-compat-1020:1.1.1.9
	pgoyette-compat-0930:1.1.1.9
	pgoyette-compat-0906:1.1.1.9
	netbsd-7-2-RELEASE:1.1.1.5
	pgoyette-compat-0728:1.1.1.9
	clang-337282:1.1.1.9
	netbsd-8-0-RELEASE:1.1.1.7
	phil-wifi:1.1.1.8.0.4
	phil-wifi-base:1.1.1.8
	pgoyette-compat-0625:1.1.1.8
	netbsd-8-0-RC2:1.1.1.7
	pgoyette-compat-0521:1.1.1.8
	pgoyette-compat-0502:1.1.1.8
	pgoyette-compat-0422:1.1.1.8
	netbsd-8-0-RC1:1.1.1.7
	pgoyette-compat-0415:1.1.1.8
	pgoyette-compat-0407:1.1.1.8
	pgoyette-compat-0330:1.1.1.8
	pgoyette-compat-0322:1.1.1.8
	pgoyette-compat-0315:1.1.1.8
	netbsd-7-1-2-RELEASE:1.1.1.5
	pgoyette-compat:1.1.1.8.0.2
	pgoyette-compat-base:1.1.1.8
	netbsd-7-1-1-RELEASE:1.1.1.5
	clang-319952:1.1.1.8
	matt-nb8-mediatek:1.1.1.7.0.10
	matt-nb8-mediatek-base:1.1.1.7
	clang-309604:1.1.1.8
	perseant-stdc-iso10646:1.1.1.7.0.8
	perseant-stdc-iso10646-base:1.1.1.7
	netbsd-8:1.1.1.7.0.6
	netbsd-8-base:1.1.1.7
	prg-localcount2-base3:1.1.1.7
	prg-localcount2-base2:1.1.1.7
	prg-localcount2-base1:1.1.1.7
	prg-localcount2:1.1.1.7.0.4
	prg-localcount2-base:1.1.1.7
	pgoyette-localcount-20170426:1.1.1.7
	bouyer-socketcan-base1:1.1.1.7
	pgoyette-localcount-20170320:1.1.1.7
	netbsd-7-1:1.1.1.5.0.10
	netbsd-7-1-RELEASE:1.1.1.5
	netbsd-7-1-RC2:1.1.1.5
	clang-294123:1.1.1.7
	netbsd-7-nhusb-base-20170116:1.1.1.5
	bouyer-socketcan:1.1.1.7.0.2
	bouyer-socketcan-base:1.1.1.7
	clang-291444:1.1.1.7
	pgoyette-localcount-20170107:1.1.1.6
	netbsd-7-1-RC1:1.1.1.5
	pgoyette-localcount-20161104:1.1.1.6
	netbsd-7-0-2-RELEASE:1.1.1.5
	localcount-20160914:1.1.1.6
	netbsd-7-nhusb:1.1.1.5.0.8
	netbsd-7-nhusb-base:1.1.1.5
	clang-280599:1.1.1.6
	pgoyette-localcount-20160806:1.1.1.6
	pgoyette-localcount-20160726:1.1.1.6
	pgoyette-localcount:1.1.1.6.0.2
	pgoyette-localcount-base:1.1.1.6
	netbsd-7-0-1-RELEASE:1.1.1.5
	clang-261930:1.1.1.6
	netbsd-7-0:1.1.1.5.0.6
	netbsd-7-0-RELEASE:1.1.1.5
	netbsd-7-0-RC3:1.1.1.5
	netbsd-7-0-RC2:1.1.1.5
	netbsd-7-0-RC1:1.1.1.5
	clang-237755:1.1.1.5
	clang-232565:1.1.1.5
	clang-227398:1.1.1.5
	tls-maxphys-base:1.1.1.5
	tls-maxphys:1.1.1.5.0.4
	netbsd-7:1.1.1.5.0.2
	netbsd-7-base:1.1.1.5
	clang-215315:1.1.1.5
	clang-209886:1.1.1.4
	yamt-pagecache:1.1.1.3.0.4
	yamt-pagecache-base9:1.1.1.3
	tls-earlyentropy:1.1.1.3.0.2
	tls-earlyentropy-base:1.1.1.4
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.3
	riastradh-drm2-base3:1.1.1.3
	clang-202566:1.1.1.3
	clang-201163:1.1.1.3
	clang-199312:1.1.1.2
	clang-198450:1.1.1.1
	clang-196603:1.1.1.1
	clang-195771:1.1.1.1
	LLVM:1.1.1;
locks; strict;
comment	@// @;


1.1
date	2013.11.28.14.14.58;	author joerg;	state Exp;
branches
	1.1.1.1;
next	;
commitid	ow8OybrawrB1f3fx;

1.1.1.1
date	2013.11.28.14.14.58;	author joerg;	state Exp;
branches;
next	1.1.1.2;
commitid	ow8OybrawrB1f3fx;

1.1.1.2
date	2014.01.15.21.26.09;	author joerg;	state Exp;
branches;
next	1.1.1.3;
commitid	NQXlzzA0SPkc5glx;

1.1.1.3
date	2014.02.14.20.07.35;	author joerg;	state Exp;
branches
	1.1.1.3.2.1
	1.1.1.3.4.1;
next	1.1.1.4;
commitid	annVkZ1sc17rF6px;

1.1.1.4
date	2014.05.30.18.14.47;	author joerg;	state Exp;
branches;
next	1.1.1.5;
commitid	8q0kdlBlCn09GACx;

1.1.1.5
date	2014.08.10.17.08.40;	author joerg;	state Exp;
branches
	1.1.1.5.4.1;
next	1.1.1.6;
commitid	N85tXAN6Ex9VZPLx;

1.1.1.6
date	2016.02.27.22.10.24;	author joerg;	state Exp;
branches
	1.1.1.6.2.1;
next	1.1.1.7;
commitid	tIimz3oDlh1NpBWy;

1.1.1.7
date	2017.01.11.10.40.06;	author joerg;	state Exp;
branches;
next	1.1.1.8;
commitid	CNnUNfII1jgNmxBz;

1.1.1.8
date	2017.08.01.19.34.22;	author joerg;	state Exp;
branches
	1.1.1.8.2.1
	1.1.1.8.4.1;
next	1.1.1.9;
commitid	pMuDy65V0VicSx1A;

1.1.1.9
date	2018.07.17.18.31.27;	author joerg;	state Exp;
branches;
next	1.1.1.10;
commitid	wDzL46ALjrCZgwKA;

1.1.1.10
date	2019.11.13.22.20.15;	author joerg;	state dead;
branches;
next	;
commitid	QD8YATxuNG34YJKB;

1.1.1.3.2.1
date	2014.08.10.07.08.14;	author tls;	state Exp;
branches;
next	;
commitid	t01A1TLTYxkpGMLx;

1.1.1.3.4.1
date	2014.02.14.20.07.35;	author yamt;	state dead;
branches;
next	1.1.1.3.4.2;
commitid	WSrDtL5nYAUyiyBx;

1.1.1.3.4.2
date	2014.05.22.16.18.57;	author yamt;	state Exp;
branches;
next	;
commitid	WSrDtL5nYAUyiyBx;

1.1.1.5.4.1
date	2014.08.10.17.08.40;	author tls;	state dead;
branches;
next	1.1.1.5.4.2;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.5.4.2
date	2014.08.19.23.47.58;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.6.2.1
date	2017.03.20.06.52.59;	author pgoyette;	state Exp;
branches;
next	;
commitid	jjw7cAwgyKq7RfKz;

1.1.1.8.2.1
date	2018.07.28.04.33.42;	author pgoyette;	state Exp;
branches;
next	;
commitid	1UP1xAIUxv1ZgRLA;

1.1.1.8.4.1
date	2019.06.10.21.45.52;	author christos;	state Exp;
branches;
next	1.1.1.8.4.2;
commitid	jtc8rnCzWiEEHGqB;

1.1.1.8.4.2
date	2020.04.13.07.47.29;	author martin;	state dead;
branches;
next	;
commitid	X01YhRUPVUDaec4C;


desc
@@


1.1
log
@Initial revision
@
text
@// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-linux | FileCheck -check-prefix LINUX %s
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -cxx-abi microsoft -fno-rtti | FileCheck -check-prefix WIN32 %s
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-win32 -mconstructor-aliases -cxx-abi microsoft -fno-rtti | FileCheck -check-prefix WIN64 %s

struct Empty {};

struct EmptyWithCtor {
  EmptyWithCtor() {}
};

struct Small {
  int x;
};

// This is a C++11 trivial and standard-layout struct but not a C++03 POD.
struct SmallCpp11NotCpp03Pod : Empty {
  int x;
};

struct SmallWithCtor {
  SmallWithCtor() {}
  int x;
};

struct SmallWithDtor {
  SmallWithDtor();
  ~SmallWithDtor();
  int x;
};

struct SmallWithVftable {
  int x;
  virtual void foo();
};

struct Medium {
  int x, y;
};

struct MediumWithCopyCtor {
  MediumWithCopyCtor();
  MediumWithCopyCtor(const struct MediumWithCopyCtor &);
  int x, y;
};

struct Big {
  int a, b, c, d, e, f;
};

// Returning structs that fit into a register.
Small small_return() { return Small(); }
// LINUX-LABEL: define void @@_Z12small_returnv(%struct.Small* noalias sret %agg.result)
// WIN32: define i32 @@"\01?small_return@@@@YA?AUSmall@@@@XZ"()
// WIN64: define i32 @@"\01?small_return@@@@YA?AUSmall@@@@XZ"()

Medium medium_return() { return Medium(); }
// LINUX-LABEL: define void @@_Z13medium_returnv(%struct.Medium* noalias sret %agg.result)
// WIN32: define i64 @@"\01?medium_return@@@@YA?AUMedium@@@@XZ"()
// WIN64: define i64 @@"\01?medium_return@@@@YA?AUMedium@@@@XZ"()

// Returning structs that fit into a register but are not POD.
SmallCpp11NotCpp03Pod small_non_pod_return() { return SmallCpp11NotCpp03Pod(); }
// LINUX-LABEL: define void @@_Z20small_non_pod_returnv(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
// WIN32: define void @@"\01?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
// WIN64: define void @@"\01?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)

SmallWithCtor small_with_ctor_return() { return SmallWithCtor(); }
// LINUX-LABEL: define void @@_Z22small_with_ctor_returnv(%struct.SmallWithCtor* noalias sret %agg.result)
// WIN32: define void @@"\01?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
// WIN64: define void @@"\01?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)

SmallWithVftable small_with_vftable_return() { return SmallWithVftable(); }
// LINUX-LABEL: define void @@_Z25small_with_vftable_returnv(%struct.SmallWithVftable* noalias sret %agg.result)
// WIN32: define void @@"\01?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)
// WIN64: define void @@"\01?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)

MediumWithCopyCtor medium_with_copy_ctor_return() { return MediumWithCopyCtor(); }
// LINUX-LABEL: define void @@_Z28medium_with_copy_ctor_returnv(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WIN32: define void @@"\01?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WIN64: define void @@"\01?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)

// Returning a large struct that doesn't fit into a register.
Big big_return() { return Big(); }
// LINUX-LABEL: define void @@_Z10big_returnv(%struct.Big* noalias sret %agg.result)
// WIN32: define void @@"\01?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)
// WIN64: define void @@"\01?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)


void small_arg(Small s) {}
// LINUX-LABEL: define void @@_Z9small_arg5Small(%struct.Small* byval align 4 %s)
// WIN32: define void @@"\01?small_arg@@@@YAXUSmall@@@@@@Z"(%struct.Small* byval align 4 %s)
// WIN64: define void @@"\01?small_arg@@@@YAXUSmall@@@@@@Z"(i32 %s.coerce)

void medium_arg(Medium s) {}
// LINUX-LABEL: define void @@_Z10medium_arg6Medium(%struct.Medium* byval align 4 %s)
// WIN32: define void @@"\01?medium_arg@@@@YAXUMedium@@@@@@Z"(%struct.Medium* byval align 4 %s)
// WIN64: define void @@"\01?medium_arg@@@@YAXUMedium@@@@@@Z"(i64 %s.coerce)

void small_arg_with_ctor(SmallWithCtor s) {}
// LINUX-LABEL: define void @@_Z19small_arg_with_ctor13SmallWithCtor(%struct.SmallWithCtor* byval align 4 %s)
// WIN32: define void @@"\01?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(%struct.SmallWithCtor* byval align 4 %s)
// WIN64: define void @@"\01?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(i32 %s.coerce)

// Test that dtors are invoked in the callee.
void small_arg_with_dtor(SmallWithDtor s) {}
// WIN32: define void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* byval align 4 %s) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"(%struct.SmallWithDtor* %s)
// WIN32: }
// WIN64: define void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* byval %s) {{.*}} {
// WIN64:   call void @@"\01??1SmallWithDtor@@@@QEAA@@XZ"(%struct.SmallWithDtor* %s)
// WIN64: }

// Test that references aren't destroyed in the callee.
void ref_small_arg_with_dtor(const SmallWithDtor &s) { }
// WIN32: define void @@"\01?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* %s) {{.*}} {
// WIN32-NOT:   call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
// WIN32: }

// Test that temporaries passed by reference are destroyed in the caller.
void temporary_ref_with_dtor() {
  ref_small_arg_with_dtor(SmallWithDtor());
}
// WIN32: define void @@"\01?temporary_ref_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"\01?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"
// WIN32:   call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
// WIN32: }

void takes_two_by_val_with_dtor(SmallWithDtor a, SmallWithDtor b);
void eh_cleanup_arg_with_dtor() {
  takes_two_by_val_with_dtor(SmallWithDtor(), SmallWithDtor());
}
//   When exceptions are off, we don't have any cleanups.  See
//   microsoft-abi-exceptions.cpp for these cleanups.
// WIN32: define void @@"\01?eh_cleanup_arg_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"\01?takes_two_by_val_with_dtor@@@@YAXUSmallWithDtor@@@@0@@Z"
// WIN32-NOT: call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
// WIN32: }

void small_arg_with_vftable(SmallWithVftable s) {}
// LINUX-LABEL: define void @@_Z22small_arg_with_vftable16SmallWithVftable(%struct.SmallWithVftable* %s)
// WIN32: define void @@"\01?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(%struct.SmallWithVftable* byval align 4 %s)
// WIN64: define void @@"\01?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(%struct.SmallWithVftable* byval %s)

void medium_arg_with_copy_ctor(MediumWithCopyCtor s) {}
// LINUX-LABEL: define void @@_Z25medium_arg_with_copy_ctor18MediumWithCopyCtor(%struct.MediumWithCopyCtor* %s)
// WIN32: define void @@"\01?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* byval align 4 %s)
// WIN64: define void @@"\01?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* byval %s)

void big_arg(Big s) {}
// LINUX-LABEL: define void @@_Z7big_arg3Big(%struct.Big* byval align 4 %s)
// WIN32: define void @@"\01?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* byval align 4 %s)
// WIN64: define void @@"\01?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* %s)

// FIXME: Add WIN64 tests. Currently, even the method manglings are wrong (sic!).
class Class {
 public:
  Small thiscall_method_small() { return Small(); }
  // LINUX: define {{.*}} void @@_ZN5Class21thiscall_method_smallEv(%struct.Small* noalias sret %agg.result, %class.Class* %this)
  // WIN32: define {{.*}} x86_thiscallcc void @@"\01?thiscall_method_small@@Class@@@@QAE?AUSmall@@@@XZ"(%struct.Small* noalias sret %agg.result, %class.Class* %this)

  SmallWithCtor thiscall_method_small_with_ctor() { return SmallWithCtor(); }
  // LINUX: define {{.*}} void @@_ZN5Class31thiscall_method_small_with_ctorEv(%struct.SmallWithCtor* noalias sret %agg.result, %class.Class* %this)
  // WIN32: define {{.*}} x86_thiscallcc void @@"\01?thiscall_method_small_with_ctor@@Class@@@@QAE?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result, %class.Class* %this)

  Small __cdecl cdecl_method_small() { return Small(); }
  // LINUX: define {{.*}} void @@_ZN5Class18cdecl_method_smallEv(%struct.Small* noalias sret %agg.result, %class.Class* %this)
  // FIXME: Interesting, cdecl returns structures differently for instance
  // methods and global functions. This is not supported by Clang yet...
  // FIXME: Replace WIN32-NOT with WIN32 when this is fixed.
  // WIN32-NOT: define {{.*}} void @@"\01?cdecl_method_small@@Class@@@@QAA?AUSmall@@@@XZ"(%struct.Small* noalias sret %agg.result, %class.Class* %this)

  Big __cdecl cdecl_method_big() { return Big(); }
  // LINUX: define {{.*}} void @@_ZN5Class16cdecl_method_bigEv(%struct.Big* noalias sret %agg.result, %class.Class* %this)
  // WIN32: define {{.*}} void @@"\01?cdecl_method_big@@Class@@@@QAA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result, %class.Class* %this)

  void thiscall_method_arg(Empty s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE5Empty(%class.Class* %this)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUEmpty@@@@@@Z"(%class.Class* %this, %struct.Empty* byval align 4 %s)

  void thiscall_method_arg(EmptyWithCtor s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE13EmptyWithCtor(%class.Class* %this)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, %struct.EmptyWithCtor* byval align 4 %s)

  void thiscall_method_arg(Small s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE5Small(%class.Class* %this, %struct.Small* byval align 4 %s)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUSmall@@@@@@Z"(%class.Class* %this, %struct.Small* byval align 4 %s)

  void thiscall_method_arg(SmallWithCtor s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE13SmallWithCtor(%class.Class* %this, %struct.SmallWithCtor* byval align 4 %s)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUSmallWithCtor@@@@@@Z"(%class.Class* %this, %struct.SmallWithCtor* byval align 4 %s)

  void thiscall_method_arg(Big s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE3Big(%class.Class* %this, %struct.Big* byval align 4 %s)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* byval align 4 %s)
};

void use_class() {
  Class c;
  c.thiscall_method_small();
  c.thiscall_method_small_with_ctor();

  c.cdecl_method_small();
  c.cdecl_method_big();

  c.thiscall_method_arg(Empty());
  c.thiscall_method_arg(EmptyWithCtor());
  c.thiscall_method_arg(Small());
  c.thiscall_method_arg(SmallWithCtor());
  c.thiscall_method_arg(Big());
}

struct X {
  X();
  ~X();
};
void g(X) {
}
// WIN32: define void @@"\01?g@@@@YAXUX@@@@@@Z"(%struct.X* byval align 4) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"\01??1X@@@@QAE@@XZ"(%struct.X* %0)
// WIN32: }
void f() {
  g(X());
}
// WIN32: define void @@"\01?f@@@@YAXXZ"() {{.*}} {
// WIN32-NOT: call {{.*}} @@"\01??1X@@@@QAE@@XZ"
// WIN32: }
@


1.1.1.1
log
@Import Clang 3.4rc1 r195771.
@
text
@@


1.1.1.2
log
@Import Clang 3.5svn r199312
@
text
@d2 2
a3 2
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN32 %s
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN64 %s
@


1.1.1.3
log
@Import Clang 3.5svn r201163.
@
text
@a49 8
// WIN32: declare void @@"{{.*take_bools_and_chars.*}}"
// WIN32:       (<{ i8, [3 x i8], i8, [3 x i8], %struct.SmallWithDtor,
// WIN32:           i8, [3 x i8], i8, [3 x i8], i32, i8 }>* inalloca)
void take_bools_and_chars(char a, char b, SmallWithDtor c, char d, bool e, int f, bool g);
void call_bools_and_chars() {
  take_bools_and_chars('A', 'B', SmallWithDtor(), 'D', true, 13, false);
}

d106 2
a107 2
// WIN32: define void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(<{ %struct.SmallWithDtor }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
d109 2
a110 2
// WIN64: define void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* %s) {{.*}} {
// WIN64:   call void @@"\01??1SmallWithDtor@@@@QEAA@@XZ"
d144 2
a145 2
// WIN32: define void @@"\01?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(<{ %struct.SmallWithVftable }>* inalloca)
// WIN64: define void @@"\01?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(%struct.SmallWithVftable* %s)
d149 2
a150 2
// WIN32: define void @@"\01?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(<{ %struct.MediumWithCopyCtor }>* inalloca)
// WIN64: define void @@"\01?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* %s)
d170 4
a173 1
  // WIN32: define {{.*}} void @@"\01?cdecl_method_small@@Class@@@@QAA?AUSmall@@@@XZ"(%struct.Small* noalias sret %agg.result, %class.Class* %this)
d221 2
a222 2
// WIN32: define void @@"\01?g@@@@YAXUX@@@@@@Z"(<{ %struct.X }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"\01??1X@@@@QAE@@XZ"(%struct.X* {{.*}})
a229 31


namespace test2 {
// We used to crash on this due to the mixture of POD byval and non-trivial
// byval.

struct NonTrivial {
  NonTrivial();
  NonTrivial(const NonTrivial &o);
  ~NonTrivial();
  int a;
};
struct POD { int b; };

int foo(NonTrivial a, POD b);
void bar() {
  POD b;
  b.b = 13;
  int c = foo(NonTrivial(), b);
}
// WIN32-LABEL: define void @@"\01?bar@@test2@@@@YAXXZ"() {{.*}} {
// WIN32:   %[[argmem:[^ ]*]] = alloca [[argmem_ty:<{ %"struct.test2::NonTrivial", %"struct.test2::POD" }>]], inalloca
// WIN32:   getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 1
// WIN32:   call void @@llvm.memcpy
// WIN32:   getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 0
// WIN32:   call x86_thiscallcc %"struct.test2::NonTrivial"* @@"\01??0NonTrivial@@test2@@@@QAE@@XZ"
// WIN32:   call i32 @@"\01?foo@@test2@@@@YAHUNonTrivial@@1@@UPOD@@1@@@@Z"([[argmem_ty]]* inalloca %argmem)
// WIN32:   ret void
// WIN32: }

}
@


1.1.1.3.2.1
log
@Rebase.
@
text
@a49 6
struct BigWithDtor {
  BigWithDtor();
  ~BigWithDtor();
  int a, b, c, d, e, f;
};

d52 1
a52 1
// WIN32:           i8, [3 x i8], i8, [3 x i8], i32, i8, [3 x i8] }>* inalloca)
d117 1
a117 1
// WIN64: define void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %s.coerce) {{.*}} {
a120 11
void call_small_arg_with_dtor() {
  small_arg_with_dtor(SmallWithDtor());
}
// The temporary is copied, so it's destroyed in the caller as well as the
// callee.
// WIN64-LABEL: define void @@"\01?call_small_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %{{.*}})
// WIN64:   call void @@"\01??1SmallWithDtor@@@@QEAA@@XZ"
// WIN64:   ret void

d123 1
a123 1
// WIN32: define void @@"\01?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* nonnull %s) {{.*}} {
a125 17
// WIN64-LABEL: define void @@"\01?ref_small_arg_with_dtor@@@@YAXAEBUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* nonnull %s)

void big_arg_with_dtor(BigWithDtor s) {}
// WIN64-LABEL: define void @@"\01?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %s)
// WIN64:   call void @@"\01??1BigWithDtor@@@@QEAA@@XZ"
// WIN64: }

void call_big_arg_with_dtor() {
  big_arg_with_dtor(BigWithDtor());
}
// We can elide the copy of the temporary in the caller, because this object is
// larger than 8 bytes and is passed indirectly.
// WIN64-LABEL: define void @@"\01?call_big_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.BigWithDtor* @@"\01??0BigWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"\01?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %{{.*}})
// WIN64-NOT: call void @@"\01??1BigWithDtor@@@@QEAA@@XZ"
// WIN64:   ret void
d165 1
d170 1
a170 2
  // WIN32: define {{.*}} x86_thiscallcc void @@"\01?thiscall_method_small@@Class@@@@QAE?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
d174 1
a174 2
  // WIN32: define {{.*}} x86_thiscallcc void @@"\01?thiscall_method_small_with_ctor@@Class@@@@QAE?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_small_with_ctor@@Class@@@@QEAA?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)
d178 1
a178 2
  // WIN32: define {{.*}} void @@"\01?cdecl_method_small@@Class@@@@QAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?cdecl_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
d182 1
a182 2
  // WIN32: define {{.*}} void @@"\01?cdecl_method_big@@Class@@@@QAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?cdecl_method_big@@Class@@@@QEAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)
a186 1
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUEmpty@@@@@@Z"(%class.Class* %this, i8 %s.coerce)
a190 1
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, i8 %s.coerce)
a194 1
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUSmall@@@@@@Z"(%class.Class* %this, i32 %s.coerce)
a198 1
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUSmallWithCtor@@@@@@Z"(%class.Class* %this, i32 %s.coerce)
a202 1
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* %s)
d226 1
a226 1
// WIN32: define void @@"\01?g@@@@YAXUX@@@@@@Z"(<{ %struct.X, [3 x i8] }>* inalloca) {{.*}} {
d256 1
a256 1
// WIN32:   %[[argmem:[^ ]*]] = alloca inalloca [[argmem_ty:<{ %"struct.test2::NonTrivial", %"struct.test2::POD" }>]]
a265 38

namespace test3 {

// Check that we padded the inalloca struct to a multiple of 4.
struct NonTrivial {
  NonTrivial();
  NonTrivial(const NonTrivial &o);
  ~NonTrivial();
  int a;
};
void foo(NonTrivial a, bool b) { }
// WIN32-LABEL: define void @@"\01?foo@@test3@@@@YAXUNonTrivial@@1@@_N@@Z"(<{ %"struct.test3::NonTrivial", i8, [3 x i8] }>* inalloca)

}

// We would crash here because the later definition of ForwardDeclare1 results
// in a different IR type for the value we want to store.  However, the alloca's
// type will use the argument type selected by fn1.
struct ForwardDeclare1;

typedef void (*FnPtr1)(ForwardDeclare1);
void fn1(FnPtr1 a, SmallWithDtor b) { }

struct ForwardDeclare1 {};

void fn2(FnPtr1 a, SmallWithDtor b) { fn1(a, b); };
// WIN32-LABEL: define void @@"\01?fn2@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"
// WIN32:   %[[a:[^ ]*]] = getelementptr inbounds [[argmem_ty:<{ {}\*, %struct.SmallWithDtor }>]]* %{{.*}}, i32 0, i32 0
// WIN32:   %[[a1:[^ ]*]] = bitcast {}** %[[a]] to void [[dst_ty:\(%struct.ForwardDeclare1\*\)\*]]*
// WIN32:   %[[argmem:[^ ]*]] = alloca inalloca [[argmem_ty]]
// WIN32:   %[[gep1:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 1
// WIN32:   %[[bc1:[^ ]*]] = bitcast %struct.SmallWithDtor* %[[gep1]] to i8*
// WIN32:   call void @@llvm.memcpy.p0i8.p0i8.i32(i8* %[[bc1]], i8* {{.*}}, i32 4, i32 4, i1 false)
// WIN32:   %[[a2:[^ ]*]] = load void [[dst_ty]]* %[[a1]], align 4
// WIN32:   %[[gep2:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 0
// WIN32:   %[[addr:[^ ]*]] = bitcast {}** %[[gep2]] to void [[dst_ty]]*
// WIN32:   store void [[dst_ty]] %[[a2]], void [[dst_ty]]* %[[addr]], align 4
// WIN32:   call void @@"\01?fn1@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"([[argmem_ty]]* inalloca %[[argmem]])
@


1.1.1.4
log
@Import Clang 3.5svn r209886.
@
text
@a49 6
struct BigWithDtor {
  BigWithDtor();
  ~BigWithDtor();
  int a, b, c, d, e, f;
};

d52 1
a52 1
// WIN32:           i8, [3 x i8], i8, [3 x i8], i32, i8, [3 x i8] }>* inalloca)
d117 1
a117 1
// WIN64: define void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %s.coerce) {{.*}} {
a120 11
void call_small_arg_with_dtor() {
  small_arg_with_dtor(SmallWithDtor());
}
// The temporary is copied, so it's destroyed in the caller as well as the
// callee.
// WIN64-LABEL: define void @@"\01?call_small_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %{{.*}})
// WIN64:   call void @@"\01??1SmallWithDtor@@@@QEAA@@XZ"
// WIN64:   ret void

d123 1
a123 1
// WIN32: define void @@"\01?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* nonnull %s) {{.*}} {
a125 17
// WIN64-LABEL: define void @@"\01?ref_small_arg_with_dtor@@@@YAXAEBUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* nonnull %s)

void big_arg_with_dtor(BigWithDtor s) {}
// WIN64-LABEL: define void @@"\01?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %s)
// WIN64:   call void @@"\01??1BigWithDtor@@@@QEAA@@XZ"
// WIN64: }

void call_big_arg_with_dtor() {
  big_arg_with_dtor(BigWithDtor());
}
// We can elide the copy of the temporary in the caller, because this object is
// larger than 8 bytes and is passed indirectly.
// WIN64-LABEL: define void @@"\01?call_big_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.BigWithDtor* @@"\01??0BigWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"\01?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %{{.*}})
// WIN64-NOT: call void @@"\01??1BigWithDtor@@@@QEAA@@XZ"
// WIN64:   ret void
d165 1
d170 1
a170 2
  // WIN32: define {{.*}} x86_thiscallcc void @@"\01?thiscall_method_small@@Class@@@@QAE?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
d174 1
a174 2
  // WIN32: define {{.*}} x86_thiscallcc void @@"\01?thiscall_method_small_with_ctor@@Class@@@@QAE?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_small_with_ctor@@Class@@@@QEAA?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)
d178 1
a178 2
  // WIN32: define {{.*}} void @@"\01?cdecl_method_small@@Class@@@@QAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?cdecl_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
d182 1
a182 2
  // WIN32: define {{.*}} void @@"\01?cdecl_method_big@@Class@@@@QAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?cdecl_method_big@@Class@@@@QEAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)
a186 1
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUEmpty@@@@@@Z"(%class.Class* %this, i8 %s.coerce)
a190 1
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, i8 %s.coerce)
a194 1
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUSmall@@@@@@Z"(%class.Class* %this, i32 %s.coerce)
a198 1
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUSmallWithCtor@@@@@@Z"(%class.Class* %this, i32 %s.coerce)
a202 1
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* %s)
d226 1
a226 1
// WIN32: define void @@"\01?g@@@@YAXUX@@@@@@Z"(<{ %struct.X, [3 x i8] }>* inalloca) {{.*}} {
d256 1
a256 1
// WIN32:   %[[argmem:[^ ]*]] = alloca inalloca [[argmem_ty:<{ %"struct.test2::NonTrivial", %"struct.test2::POD" }>]]
a265 38

namespace test3 {

// Check that we padded the inalloca struct to a multiple of 4.
struct NonTrivial {
  NonTrivial();
  NonTrivial(const NonTrivial &o);
  ~NonTrivial();
  int a;
};
void foo(NonTrivial a, bool b) { }
// WIN32-LABEL: define void @@"\01?foo@@test3@@@@YAXUNonTrivial@@1@@_N@@Z"(<{ %"struct.test3::NonTrivial", i8, [3 x i8] }>* inalloca)

}

// We would crash here because the later definition of ForwardDeclare1 results
// in a different IR type for the value we want to store.  However, the alloca's
// type will use the argument type selected by fn1.
struct ForwardDeclare1;

typedef void (*FnPtr1)(ForwardDeclare1);
void fn1(FnPtr1 a, SmallWithDtor b) { }

struct ForwardDeclare1 {};

void fn2(FnPtr1 a, SmallWithDtor b) { fn1(a, b); };
// WIN32-LABEL: define void @@"\01?fn2@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"
// WIN32:   %[[a:[^ ]*]] = getelementptr inbounds [[argmem_ty:<{ {}\*, %struct.SmallWithDtor }>]]* %{{.*}}, i32 0, i32 0
// WIN32:   %[[a1:[^ ]*]] = bitcast {}** %[[a]] to void [[dst_ty:\(%struct.ForwardDeclare1\*\)\*]]*
// WIN32:   %[[argmem:[^ ]*]] = alloca inalloca [[argmem_ty]]
// WIN32:   %[[gep1:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 1
// WIN32:   %[[bc1:[^ ]*]] = bitcast %struct.SmallWithDtor* %[[gep1]] to i8*
// WIN32:   call void @@llvm.memcpy.p0i8.p0i8.i32(i8* %[[bc1]], i8* {{.*}}, i32 4, i32 4, i1 false)
// WIN32:   %[[a2:[^ ]*]] = load void [[dst_ty]]* %[[a1]], align 4
// WIN32:   %[[gep2:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 0
// WIN32:   %[[addr:[^ ]*]] = bitcast {}** %[[gep2]] to void [[dst_ty]]*
// WIN32:   store void [[dst_ty]] %[[a2]], void [[dst_ty]]* %[[addr]], align 4
// WIN32:   call void @@"\01?fn1@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"([[argmem_ty]]* inalloca %[[argmem]])
@


1.1.1.5
log
@Import clang 3.6svn r215315.
@
text
@d140 1
a140 1
// WIN32: define void @@"\01?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* dereferenceable({{[0-9]+}}) %s) {{.*}} {
d143 1
a143 1
// WIN64-LABEL: define void @@"\01?ref_small_arg_with_dtor@@@@YAXAEBUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* dereferenceable({{[0-9]+}}) %s)
@


1.1.1.6
log
@Import Clang 3.8.0rc3 r261930.
@
text
@d104 1
a104 1
// LINUX-LABEL: define void @@_Z9small_arg5Small(i32 %s.0)
d109 1
a109 1
// LINUX-LABEL: define void @@_Z10medium_arg6Medium(i32 %s.0, i32 %s.1)
d232 1
a232 1
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE5Small(%class.Class* %this, i32 %s.0)
d299 1
a299 1
// WIN32:   getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %[[argmem]], i32 0, i32 1
d301 1
a301 1
// WIN32:   getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %[[argmem]], i32 0, i32 0
d335 1
a335 1
// WIN32:   %[[a:[^ ]*]] = getelementptr inbounds [[argmem_ty:<{ {}\*, %struct.SmallWithDtor }>]], [[argmem_ty:<{ {}\*, %struct.SmallWithDtor }>]]* %{{.*}}, i32 0, i32 0
d338 1
a338 1
// WIN32:   %[[gep1:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %[[argmem]], i32 0, i32 1
d341 2
a342 2
// WIN32:   %[[a2:[^ ]*]] = load void [[dst_ty]], void [[dst_ty]]* %[[a1]], align 4
// WIN32:   %[[gep2:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %[[argmem]], i32 0, i32 0
@


1.1.1.6.2.1
log
@Sync with HEAD
@
text
@d1 3
a3 4
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=i386-pc-linux | FileCheck -check-prefix LINUX %s
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN32 %s
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=thumb-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WOA %s
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN64 %s
a24 10
struct Multibyte {
  char a, b, c, d;
};

struct Packed {
  short a;
  int b;
  short c;
};

a84 3
// FIXME: The 'sret' mark here doesn't seem to be enough to convince LLVM to
// preserve the hidden sret pointer in R0 across the function.
// WOA: define arm_aapcs_vfpcc void @@"\01?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
a94 1
// WOA: define arm_aapcs_vfpcc void @@"\01?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
d105 1
a105 1
// WIN32: define void @@"\01?small_arg@@@@YAXUSmall@@@@@@Z"(i32 %s.0)
a106 1
// WOA: define arm_aapcs_vfpcc void @@"\01?small_arg@@@@YAXUSmall@@@@@@Z"([1 x i32] %s.coerce)
d110 1
a110 1
// WIN32: define void @@"\01?medium_arg@@@@YAXUMedium@@@@@@Z"(i32 %s.0, i32 %s.1)
a111 1
// WOA: define arm_aapcs_vfpcc void @@"\01?medium_arg@@@@YAXUMedium@@@@@@Z"([2 x i32] %s.coerce)
d115 1
a115 1
// WIN32: define void @@"\01?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(i32 %s.0)
a116 13
// WOA: define arm_aapcs_vfpcc void @@"\01?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"([1 x i32] %s.coerce)

// FIXME: We could coerce to a series of i32s here if we wanted to.
void multibyte_arg(Multibyte s) {}
// LINUX-LABEL: define void @@_Z13multibyte_arg9Multibyte(%struct.Multibyte* byval align 4 %s)
// WIN32: define void @@"\01?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"(%struct.Multibyte* byval align 4 %s)
// WIN64: define void @@"\01?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"(i32 %s.coerce)
// WOA: define arm_aapcs_vfpcc void @@"\01?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"([1 x i32] %s.coerce)

void packed_arg(Packed s) {}
// LINUX-LABEL: define void @@_Z10packed_arg6Packed(%struct.Packed* byval align 4 %s)
// WIN32: define void @@"\01?packed_arg@@@@YAXUPacked@@@@@@Z"(%struct.Packed* byval align 4 %s)
// WIN64: define void @@"\01?packed_arg@@@@YAXUPacked@@@@@@Z"(%struct.Packed* %s)
a126 5
// FIXME: MSVC incompatible!
// WOA: define arm_aapcs_vfpcc void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* %s) {{.*}} {
// WOA:   call arm_aapcs_vfpcc void @@"\01??1SmallWithDtor@@@@QAA@@XZ"(%struct.SmallWithDtor* %s)
// WOA: }

a192 1
// WOA: define arm_aapcs_vfpcc void @@"\01?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* %s)
a198 22
// PR27607: We would attempt to load i32 value out of the reference instead of
// just loading the pointer from the struct during argument expansion.
struct RefField {
  RefField(int &x);
  int &x;
};
void takes_ref_field(RefField s) {}
// LINUX-LABEL: define void @@_Z15takes_ref_field8RefField(%struct.RefField* byval align 4 %s)
// WIN32: define void @@"\01?takes_ref_field@@@@YAXURefField@@@@@@Z"(i32* %s.0)
// WIN64: define void @@"\01?takes_ref_field@@@@YAXURefField@@@@@@Z"(i64 %s.coerce)

void pass_ref_field() {
  int x;
  takes_ref_field(RefField(x));
}
// LINUX-LABEL: define void @@_Z14pass_ref_fieldv()
// LINUX: call void @@_Z15takes_ref_field8RefField(%struct.RefField* byval align 4 %{{.*}})
// WIN32-LABEL: define void @@"\01?pass_ref_field@@@@YAXXZ"()
// WIN32: call void @@"\01?takes_ref_field@@@@YAXURefField@@@@@@Z"(i32* %{{.*}})
// WIN64-LABEL: define void @@"\01?pass_ref_field@@@@YAXXZ"()
// WIN64: call void @@"\01?takes_ref_field@@@@YAXURefField@@@@@@Z"(i64 %{{.*}})

d233 1
a233 1
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUSmall@@@@@@Z"(%class.Class* %this, i32 %s.0)
d238 1
a238 1
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUSmallWithCtor@@@@@@Z"(%class.Class* %this, i32 %s.0)
a345 27

namespace pr30293 {
// Virtual methods living in a secondary vtable take i8* as their 'this'
// parameter because the 'this' parameter on entry points to the secondary
// vptr. We used to have a bug where we didn't apply this rule consistently,
// and it would cause assertion failures when used with inalloca.
struct A {
  virtual void f();
};
struct B {
  virtual void __cdecl h(SmallWithDtor);
};
struct C final : A, B {
  void g();
  void __cdecl h(SmallWithDtor);
  void f();
};
void C::g() { return h(SmallWithDtor()); }

// WIN32-LABEL: define x86_thiscallcc void @@"\01?g@@C@@pr30293@@@@QAEXXZ"(%"struct.pr30293::C"* %this)
// WIN32: call x86_thiscallcc %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QAE@@XZ"
// WIN32: call void @@"\01?h@@C@@pr30293@@@@UAAXUSmallWithDtor@@@@@@Z"(<{ i8*, %struct.SmallWithDtor }>* inalloca %{{[^,)]*}})
// WIN32: declare void @@"\01?h@@C@@pr30293@@@@UAAXUSmallWithDtor@@@@@@Z"(<{ i8*, %struct.SmallWithDtor }>* inalloca)

// WIN64-LABEL: define void @@"\01?g@@C@@pr30293@@@@QEAAXXZ"(%"struct.pr30293::C"* %this)
// WIN64: declare void @@"\01?h@@C@@pr30293@@@@UEAAXUSmallWithDtor@@@@@@Z"(i8*, i32)
}
@


1.1.1.7
log
@Import Clang pre-4.0.0 r291444.
@
text
@d1 3
a3 4
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=i386-pc-linux | FileCheck -check-prefix LINUX %s
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN32 %s
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=thumb-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WOA %s
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN64 %s
a24 10
struct Multibyte {
  char a, b, c, d;
};

struct Packed {
  short a;
  int b;
  short c;
};

a84 3
// FIXME: The 'sret' mark here doesn't seem to be enough to convince LLVM to
// preserve the hidden sret pointer in R0 across the function.
// WOA: define arm_aapcs_vfpcc void @@"\01?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
a94 1
// WOA: define arm_aapcs_vfpcc void @@"\01?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
d105 1
a105 1
// WIN32: define void @@"\01?small_arg@@@@YAXUSmall@@@@@@Z"(i32 %s.0)
a106 1
// WOA: define arm_aapcs_vfpcc void @@"\01?small_arg@@@@YAXUSmall@@@@@@Z"([1 x i32] %s.coerce)
d110 1
a110 1
// WIN32: define void @@"\01?medium_arg@@@@YAXUMedium@@@@@@Z"(i32 %s.0, i32 %s.1)
a111 1
// WOA: define arm_aapcs_vfpcc void @@"\01?medium_arg@@@@YAXUMedium@@@@@@Z"([2 x i32] %s.coerce)
d115 1
a115 1
// WIN32: define void @@"\01?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(i32 %s.0)
a116 13
// WOA: define arm_aapcs_vfpcc void @@"\01?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"([1 x i32] %s.coerce)

// FIXME: We could coerce to a series of i32s here if we wanted to.
void multibyte_arg(Multibyte s) {}
// LINUX-LABEL: define void @@_Z13multibyte_arg9Multibyte(%struct.Multibyte* byval align 4 %s)
// WIN32: define void @@"\01?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"(%struct.Multibyte* byval align 4 %s)
// WIN64: define void @@"\01?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"(i32 %s.coerce)
// WOA: define arm_aapcs_vfpcc void @@"\01?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"([1 x i32] %s.coerce)

void packed_arg(Packed s) {}
// LINUX-LABEL: define void @@_Z10packed_arg6Packed(%struct.Packed* byval align 4 %s)
// WIN32: define void @@"\01?packed_arg@@@@YAXUPacked@@@@@@Z"(%struct.Packed* byval align 4 %s)
// WIN64: define void @@"\01?packed_arg@@@@YAXUPacked@@@@@@Z"(%struct.Packed* %s)
a126 5
// FIXME: MSVC incompatible!
// WOA: define arm_aapcs_vfpcc void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* %s) {{.*}} {
// WOA:   call arm_aapcs_vfpcc void @@"\01??1SmallWithDtor@@@@QAA@@XZ"(%struct.SmallWithDtor* %s)
// WOA: }

a192 1
// WOA: define arm_aapcs_vfpcc void @@"\01?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* %s)
a198 22
// PR27607: We would attempt to load i32 value out of the reference instead of
// just loading the pointer from the struct during argument expansion.
struct RefField {
  RefField(int &x);
  int &x;
};
void takes_ref_field(RefField s) {}
// LINUX-LABEL: define void @@_Z15takes_ref_field8RefField(%struct.RefField* byval align 4 %s)
// WIN32: define void @@"\01?takes_ref_field@@@@YAXURefField@@@@@@Z"(i32* %s.0)
// WIN64: define void @@"\01?takes_ref_field@@@@YAXURefField@@@@@@Z"(i64 %s.coerce)

void pass_ref_field() {
  int x;
  takes_ref_field(RefField(x));
}
// LINUX-LABEL: define void @@_Z14pass_ref_fieldv()
// LINUX: call void @@_Z15takes_ref_field8RefField(%struct.RefField* byval align 4 %{{.*}})
// WIN32-LABEL: define void @@"\01?pass_ref_field@@@@YAXXZ"()
// WIN32: call void @@"\01?takes_ref_field@@@@YAXURefField@@@@@@Z"(i32* %{{.*}})
// WIN64-LABEL: define void @@"\01?pass_ref_field@@@@YAXXZ"()
// WIN64: call void @@"\01?takes_ref_field@@@@YAXURefField@@@@@@Z"(i64 %{{.*}})

d233 1
a233 1
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUSmall@@@@@@Z"(%class.Class* %this, i32 %s.0)
d238 1
a238 1
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUSmallWithCtor@@@@@@Z"(%class.Class* %this, i32 %s.0)
a345 27

namespace pr30293 {
// Virtual methods living in a secondary vtable take i8* as their 'this'
// parameter because the 'this' parameter on entry points to the secondary
// vptr. We used to have a bug where we didn't apply this rule consistently,
// and it would cause assertion failures when used with inalloca.
struct A {
  virtual void f();
};
struct B {
  virtual void __cdecl h(SmallWithDtor);
};
struct C final : A, B {
  void g();
  void __cdecl h(SmallWithDtor);
  void f();
};
void C::g() { return h(SmallWithDtor()); }

// WIN32-LABEL: define x86_thiscallcc void @@"\01?g@@C@@pr30293@@@@QAEXXZ"(%"struct.pr30293::C"* %this)
// WIN32: call x86_thiscallcc %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QAE@@XZ"
// WIN32: call void @@"\01?h@@C@@pr30293@@@@UAAXUSmallWithDtor@@@@@@Z"(<{ i8*, %struct.SmallWithDtor }>* inalloca %{{[^,)]*}})
// WIN32: declare void @@"\01?h@@C@@pr30293@@@@UAAXUSmallWithDtor@@@@@@Z"(<{ i8*, %struct.SmallWithDtor }>* inalloca)

// WIN64-LABEL: define void @@"\01?g@@C@@pr30293@@@@QEAAXXZ"(%"struct.pr30293::C"* %this)
// WIN64: declare void @@"\01?h@@C@@pr30293@@@@UEAAXUSmallWithDtor@@@@@@Z"(i8*, i32)
}
@


1.1.1.8
log
@Import clang r309604 from branches/release_50
@
text
@a66 4
struct BaseNoByval : Small {
  int bb;
};

a129 6
void base_no_byval_arg(BaseNoByval s) {}
// LINUX-LABEL: define void @@_Z17base_no_byval_arg11BaseNoByval(%struct.BaseNoByval* byval align 4 %s)
// WIN32: define void @@"\01?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"(i32 %s.0, i32 %s.1)
// WIN64: define void @@"\01?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"(i64 %s.coerce)
// WOA: define arm_aapcs_vfpcc void @@"\01?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"([2 x i32] %s.coerce)

@


1.1.1.8.4.1
log
@Sync with HEAD
@
text
@d71 1
a71 1
// WIN32: declare dso_local void @@"{{.*take_bools_and_chars.*}}"
d82 2
a83 2
// WIN32: define dso_local i32 @@"?small_return@@@@YA?AUSmall@@@@XZ"()
// WIN64: define dso_local i32 @@"?small_return@@@@YA?AUSmall@@@@XZ"()
d87 2
a88 2
// WIN32: define dso_local i64 @@"?medium_return@@@@YA?AUMedium@@@@XZ"()
// WIN64: define dso_local i64 @@"?medium_return@@@@YA?AUMedium@@@@XZ"()
d93 2
a94 2
// WIN32: define dso_local void @@"?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
// WIN64: define dso_local void @@"?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
d98 2
a99 2
// WIN32: define dso_local void @@"?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
// WIN64: define dso_local void @@"?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
d102 1
a102 1
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
d106 2
a107 2
// WIN32: define dso_local void @@"?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)
// WIN64: define dso_local void @@"?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)
d111 3
a113 3
// WIN32: define dso_local void @@"?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WIN64: define dso_local void @@"?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
d118 2
a119 2
// WIN32: define dso_local void @@"?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)
// WIN64: define dso_local void @@"?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)
d124 3
a126 3
// WIN32: define dso_local void @@"?small_arg@@@@YAXUSmall@@@@@@Z"(i32 %s.0)
// WIN64: define dso_local void @@"?small_arg@@@@YAXUSmall@@@@@@Z"(i32 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_arg@@@@YAXUSmall@@@@@@Z"([1 x i32] %s.coerce)
d130 3
a132 3
// WIN32: define dso_local void @@"?medium_arg@@@@YAXUMedium@@@@@@Z"(i32 %s.0, i32 %s.1)
// WIN64: define dso_local void @@"?medium_arg@@@@YAXUMedium@@@@@@Z"(i64 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?medium_arg@@@@YAXUMedium@@@@@@Z"([2 x i32] %s.coerce)
d136 3
a138 3
// WIN32: define dso_local void @@"?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"(i32 %s.0, i32 %s.1)
// WIN64: define dso_local void @@"?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"(i64 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"([2 x i32] %s.coerce)
d142 3
a144 3
// WIN32: define dso_local void @@"?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(i32 %s.0)
// WIN64: define dso_local void @@"?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(i32 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"([1 x i32] %s.coerce)
d149 3
a151 3
// WIN32: define dso_local void @@"?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"(%struct.Multibyte* byval align 4 %s)
// WIN64: define dso_local void @@"?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"(i32 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"([1 x i32] %s.coerce)
d155 2
a156 2
// WIN32: define dso_local void @@"?packed_arg@@@@YAXUPacked@@@@@@Z"(%struct.Packed* byval align 4 %s)
// WIN64: define dso_local void @@"?packed_arg@@@@YAXUPacked@@@@@@Z"(%struct.Packed* %s)
d160 2
a161 2
// WIN32: define dso_local void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(<{ %struct.SmallWithDtor }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d163 2
a164 2
// WIN64: define dso_local void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %s.coerce) {{.*}} {
// WIN64:   call void @@"??1SmallWithDtor@@@@QEAA@@XZ"
d168 2
a169 2
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* %s) {{.*}} {
// WOA:   call arm_aapcs_vfpcc void @@"??1SmallWithDtor@@@@QAA@@XZ"(%struct.SmallWithDtor* %s)
d175 6
a180 3
// WIN64-LABEL: define dso_local void @@"?call_small_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %{{.*}})
d185 2
a186 2
// WIN32: define dso_local void @@"?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* dereferenceable({{[0-9]+}}) %s) {{.*}} {
// WIN32-NOT:   call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d188 1
a188 1
// WIN64-LABEL: define dso_local void @@"?ref_small_arg_with_dtor@@@@YAXAEBUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* dereferenceable({{[0-9]+}}) %s)
d191 2
a192 2
// WIN64-LABEL: define dso_local void @@"?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %s)
// WIN64:   call void @@"??1BigWithDtor@@@@QEAA@@XZ"
d200 4
a203 4
// WIN64-LABEL: define dso_local void @@"?call_big_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.BigWithDtor* @@"??0BigWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %{{.*}})
// WIN64-NOT: call void @@"??1BigWithDtor@@@@QEAA@@XZ"
d210 4
a213 4
// WIN32: define dso_local void @@"?temporary_ref_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"
// WIN32:   call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d222 5
a226 5
// WIN32: define dso_local void @@"?eh_cleanup_arg_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"?takes_two_by_val_with_dtor@@@@YAXUSmallWithDtor@@@@0@@Z"
// WIN32-NOT: call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d231 2
a232 2
// WIN32: define dso_local void @@"?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(<{ %struct.SmallWithVftable }>* inalloca)
// WIN64: define dso_local void @@"?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(%struct.SmallWithVftable* %s)
d236 3
a238 3
// WIN32: define dso_local void @@"?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(<{ %struct.MediumWithCopyCtor }>* inalloca)
// WIN64: define dso_local void @@"?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* %s)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* %s)
d242 2
a243 2
// WIN32: define dso_local void @@"?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* byval align 4 %s)
// WIN64: define dso_local void @@"?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* %s)
d253 2
a254 2
// WIN32: define dso_local void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i32* %s.0)
// WIN64: define dso_local void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i64 %s.coerce)
d262 4
a265 4
// WIN32-LABEL: define dso_local void @@"?pass_ref_field@@@@YAXXZ"()
// WIN32: call void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i32* %{{.*}})
// WIN64-LABEL: define dso_local void @@"?pass_ref_field@@@@YAXXZ"()
// WIN64: call void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i64 %{{.*}})
d271 2
a272 2
  // WIN32: define {{.*}} x86_thiscallcc void @@"?thiscall_method_small@@Class@@@@QAE?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
d276 2
a277 2
  // WIN32: define {{.*}} x86_thiscallcc void @@"?thiscall_method_small_with_ctor@@Class@@@@QAE?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_small_with_ctor@@Class@@@@QEAA?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)
d281 2
a282 2
  // WIN32: define {{.*}} void @@"?cdecl_method_small@@Class@@@@QAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?cdecl_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
d286 2
a287 2
  // WIN32: define {{.*}} void @@"?cdecl_method_big@@Class@@@@QAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?cdecl_method_big@@Class@@@@QEAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)
d291 2
a292 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUEmpty@@@@@@Z"(%class.Class* %this, %struct.Empty* byval align 4 %s)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUEmpty@@@@@@Z"(%class.Class* %this, i8 %s.coerce)
d296 2
a297 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, %struct.EmptyWithCtor* byval align 4 %s)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, i8 %s.coerce)
d301 2
a302 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUSmall@@@@@@Z"(%class.Class* %this, i32 %s.0)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUSmall@@@@@@Z"(%class.Class* %this, i32 %s.coerce)
d306 2
a307 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUSmallWithCtor@@@@@@Z"(%class.Class* %this, i32 %s.0)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUSmallWithCtor@@@@@@Z"(%class.Class* %this, i32 %s.coerce)
d311 2
a312 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* byval align 4 %s)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* %s)
d336 2
a337 2
// WIN32: define dso_local void @@"?g@@@@YAXUX@@@@@@Z"(<{ %struct.X, [3 x i8] }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"??1X@@@@QAE@@XZ"(%struct.X* {{.*}})
d342 2
a343 2
// WIN32: define dso_local void @@"?f@@@@YAXXZ"() {{.*}} {
// WIN32-NOT: call {{.*}} @@"??1X@@@@QAE@@XZ"
d365 1
a365 1
// WIN32-LABEL: define dso_local void @@"?bar@@test2@@@@YAXXZ"() {{.*}} {
d370 2
a371 2
// WIN32:   call x86_thiscallcc %"struct.test2::NonTrivial"* @@"??0NonTrivial@@test2@@@@QAE@@XZ"
// WIN32:   call i32 @@"?foo@@test2@@@@YAHUNonTrivial@@1@@UPOD@@1@@@@Z"([[argmem_ty]]* inalloca %argmem)
d387 1
a387 1
// WIN32-LABEL: define dso_local void @@"?foo@@test3@@@@YAXUNonTrivial@@1@@_N@@Z"(<{ %"struct.test3::NonTrivial", i8, [3 x i8] }>* inalloca)
d402 1
a402 1
// WIN32-LABEL: define dso_local void @@"?fn2@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"
d408 1
a408 1
// WIN32:   call void @@llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %[[bc1]], i8* align 4 {{.*}}, i32 4, i1 false)
d413 1
a413 1
// WIN32:   call void @@"?fn1@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"([[argmem_ty]]* inalloca %[[argmem]])
d433 4
a436 4
// WIN32-LABEL: define dso_local x86_thiscallcc void @@"?g@@C@@pr30293@@@@QAEXXZ"(%"struct.pr30293::C"* %this)
// WIN32: call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32: call void @@"?h@@C@@pr30293@@@@UAAXUSmallWithDtor@@@@@@Z"(<{ i8*, %struct.SmallWithDtor }>* inalloca %{{[^,)]*}})
// WIN32: declare dso_local void @@"?h@@C@@pr30293@@@@UAAXUSmallWithDtor@@@@@@Z"(<{ i8*, %struct.SmallWithDtor }>* inalloca)
d438 2
a439 2
// WIN64-LABEL: define dso_local void @@"?g@@C@@pr30293@@@@QEAAXXZ"(%"struct.pr30293::C"* %this)
// WIN64: declare dso_local void @@"?h@@C@@pr30293@@@@UEAAXUSmallWithDtor@@@@@@Z"(i8*, i32)
@


1.1.1.8.4.2
log
@Mostly merge changes from HEAD upto 20200411
@
text
@@


1.1.1.8.2.1
log
@Sync with HEAD
@
text
@d71 1
a71 1
// WIN32: declare dso_local void @@"{{.*take_bools_and_chars.*}}"
d82 2
a83 2
// WIN32: define dso_local i32 @@"?small_return@@@@YA?AUSmall@@@@XZ"()
// WIN64: define dso_local i32 @@"?small_return@@@@YA?AUSmall@@@@XZ"()
d87 2
a88 2
// WIN32: define dso_local i64 @@"?medium_return@@@@YA?AUMedium@@@@XZ"()
// WIN64: define dso_local i64 @@"?medium_return@@@@YA?AUMedium@@@@XZ"()
d93 2
a94 2
// WIN32: define dso_local void @@"?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
// WIN64: define dso_local void @@"?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
d98 2
a99 2
// WIN32: define dso_local void @@"?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
// WIN64: define dso_local void @@"?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
d102 1
a102 1
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
d106 2
a107 2
// WIN32: define dso_local void @@"?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)
// WIN64: define dso_local void @@"?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)
d111 3
a113 3
// WIN32: define dso_local void @@"?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WIN64: define dso_local void @@"?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
d118 2
a119 2
// WIN32: define dso_local void @@"?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)
// WIN64: define dso_local void @@"?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)
d124 3
a126 3
// WIN32: define dso_local void @@"?small_arg@@@@YAXUSmall@@@@@@Z"(i32 %s.0)
// WIN64: define dso_local void @@"?small_arg@@@@YAXUSmall@@@@@@Z"(i32 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_arg@@@@YAXUSmall@@@@@@Z"([1 x i32] %s.coerce)
d130 3
a132 3
// WIN32: define dso_local void @@"?medium_arg@@@@YAXUMedium@@@@@@Z"(i32 %s.0, i32 %s.1)
// WIN64: define dso_local void @@"?medium_arg@@@@YAXUMedium@@@@@@Z"(i64 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?medium_arg@@@@YAXUMedium@@@@@@Z"([2 x i32] %s.coerce)
d136 3
a138 3
// WIN32: define dso_local void @@"?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"(i32 %s.0, i32 %s.1)
// WIN64: define dso_local void @@"?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"(i64 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"([2 x i32] %s.coerce)
d142 3
a144 3
// WIN32: define dso_local void @@"?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(i32 %s.0)
// WIN64: define dso_local void @@"?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(i32 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"([1 x i32] %s.coerce)
d149 3
a151 3
// WIN32: define dso_local void @@"?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"(%struct.Multibyte* byval align 4 %s)
// WIN64: define dso_local void @@"?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"(i32 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"([1 x i32] %s.coerce)
d155 2
a156 2
// WIN32: define dso_local void @@"?packed_arg@@@@YAXUPacked@@@@@@Z"(%struct.Packed* byval align 4 %s)
// WIN64: define dso_local void @@"?packed_arg@@@@YAXUPacked@@@@@@Z"(%struct.Packed* %s)
d160 2
a161 2
// WIN32: define dso_local void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(<{ %struct.SmallWithDtor }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d163 2
a164 2
// WIN64: define dso_local void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %s.coerce) {{.*}} {
// WIN64:   call void @@"??1SmallWithDtor@@@@QEAA@@XZ"
d168 2
a169 2
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* %s) {{.*}} {
// WOA:   call arm_aapcs_vfpcc void @@"??1SmallWithDtor@@@@QAA@@XZ"(%struct.SmallWithDtor* %s)
d175 6
a180 3
// WIN64-LABEL: define dso_local void @@"?call_small_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %{{.*}})
d185 2
a186 2
// WIN32: define dso_local void @@"?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* dereferenceable({{[0-9]+}}) %s) {{.*}} {
// WIN32-NOT:   call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d188 1
a188 1
// WIN64-LABEL: define dso_local void @@"?ref_small_arg_with_dtor@@@@YAXAEBUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* dereferenceable({{[0-9]+}}) %s)
d191 2
a192 2
// WIN64-LABEL: define dso_local void @@"?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %s)
// WIN64:   call void @@"??1BigWithDtor@@@@QEAA@@XZ"
d200 4
a203 4
// WIN64-LABEL: define dso_local void @@"?call_big_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.BigWithDtor* @@"??0BigWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %{{.*}})
// WIN64-NOT: call void @@"??1BigWithDtor@@@@QEAA@@XZ"
d210 4
a213 4
// WIN32: define dso_local void @@"?temporary_ref_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"
// WIN32:   call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d222 5
a226 5
// WIN32: define dso_local void @@"?eh_cleanup_arg_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"?takes_two_by_val_with_dtor@@@@YAXUSmallWithDtor@@@@0@@Z"
// WIN32-NOT: call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d231 2
a232 2
// WIN32: define dso_local void @@"?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(<{ %struct.SmallWithVftable }>* inalloca)
// WIN64: define dso_local void @@"?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(%struct.SmallWithVftable* %s)
d236 3
a238 3
// WIN32: define dso_local void @@"?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(<{ %struct.MediumWithCopyCtor }>* inalloca)
// WIN64: define dso_local void @@"?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* %s)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* %s)
d242 2
a243 2
// WIN32: define dso_local void @@"?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* byval align 4 %s)
// WIN64: define dso_local void @@"?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* %s)
d253 2
a254 2
// WIN32: define dso_local void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i32* %s.0)
// WIN64: define dso_local void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i64 %s.coerce)
d262 4
a265 4
// WIN32-LABEL: define dso_local void @@"?pass_ref_field@@@@YAXXZ"()
// WIN32: call void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i32* %{{.*}})
// WIN64-LABEL: define dso_local void @@"?pass_ref_field@@@@YAXXZ"()
// WIN64: call void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i64 %{{.*}})
d271 2
a272 2
  // WIN32: define {{.*}} x86_thiscallcc void @@"?thiscall_method_small@@Class@@@@QAE?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
d276 2
a277 2
  // WIN32: define {{.*}} x86_thiscallcc void @@"?thiscall_method_small_with_ctor@@Class@@@@QAE?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_small_with_ctor@@Class@@@@QEAA?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)
d281 2
a282 2
  // WIN32: define {{.*}} void @@"?cdecl_method_small@@Class@@@@QAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?cdecl_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
d286 2
a287 2
  // WIN32: define {{.*}} void @@"?cdecl_method_big@@Class@@@@QAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?cdecl_method_big@@Class@@@@QEAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)
d291 2
a292 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUEmpty@@@@@@Z"(%class.Class* %this, %struct.Empty* byval align 4 %s)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUEmpty@@@@@@Z"(%class.Class* %this, i8 %s.coerce)
d296 2
a297 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, %struct.EmptyWithCtor* byval align 4 %s)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, i8 %s.coerce)
d301 2
a302 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUSmall@@@@@@Z"(%class.Class* %this, i32 %s.0)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUSmall@@@@@@Z"(%class.Class* %this, i32 %s.coerce)
d306 2
a307 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUSmallWithCtor@@@@@@Z"(%class.Class* %this, i32 %s.0)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUSmallWithCtor@@@@@@Z"(%class.Class* %this, i32 %s.coerce)
d311 2
a312 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* byval align 4 %s)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* %s)
d336 2
a337 2
// WIN32: define dso_local void @@"?g@@@@YAXUX@@@@@@Z"(<{ %struct.X, [3 x i8] }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"??1X@@@@QAE@@XZ"(%struct.X* {{.*}})
d342 2
a343 2
// WIN32: define dso_local void @@"?f@@@@YAXXZ"() {{.*}} {
// WIN32-NOT: call {{.*}} @@"??1X@@@@QAE@@XZ"
d365 1
a365 1
// WIN32-LABEL: define dso_local void @@"?bar@@test2@@@@YAXXZ"() {{.*}} {
d370 2
a371 2
// WIN32:   call x86_thiscallcc %"struct.test2::NonTrivial"* @@"??0NonTrivial@@test2@@@@QAE@@XZ"
// WIN32:   call i32 @@"?foo@@test2@@@@YAHUNonTrivial@@1@@UPOD@@1@@@@Z"([[argmem_ty]]* inalloca %argmem)
d387 1
a387 1
// WIN32-LABEL: define dso_local void @@"?foo@@test3@@@@YAXUNonTrivial@@1@@_N@@Z"(<{ %"struct.test3::NonTrivial", i8, [3 x i8] }>* inalloca)
d402 1
a402 1
// WIN32-LABEL: define dso_local void @@"?fn2@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"
d408 1
a408 1
// WIN32:   call void @@llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %[[bc1]], i8* align 4 {{.*}}, i32 4, i1 false)
d413 1
a413 1
// WIN32:   call void @@"?fn1@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"([[argmem_ty]]* inalloca %[[argmem]])
d433 4
a436 4
// WIN32-LABEL: define dso_local x86_thiscallcc void @@"?g@@C@@pr30293@@@@QAEXXZ"(%"struct.pr30293::C"* %this)
// WIN32: call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32: call void @@"?h@@C@@pr30293@@@@UAAXUSmallWithDtor@@@@@@Z"(<{ i8*, %struct.SmallWithDtor }>* inalloca %{{[^,)]*}})
// WIN32: declare dso_local void @@"?h@@C@@pr30293@@@@UAAXUSmallWithDtor@@@@@@Z"(<{ i8*, %struct.SmallWithDtor }>* inalloca)
d438 2
a439 2
// WIN64-LABEL: define dso_local void @@"?g@@C@@pr30293@@@@QEAAXXZ"(%"struct.pr30293::C"* %this)
// WIN64: declare dso_local void @@"?h@@C@@pr30293@@@@UEAAXUSmallWithDtor@@@@@@Z"(i8*, i32)
@


1.1.1.9
log
@Import clang r337282 from trunk
@
text
@d71 1
a71 1
// WIN32: declare dso_local void @@"{{.*take_bools_and_chars.*}}"
d82 2
a83 2
// WIN32: define dso_local i32 @@"?small_return@@@@YA?AUSmall@@@@XZ"()
// WIN64: define dso_local i32 @@"?small_return@@@@YA?AUSmall@@@@XZ"()
d87 2
a88 2
// WIN32: define dso_local i64 @@"?medium_return@@@@YA?AUMedium@@@@XZ"()
// WIN64: define dso_local i64 @@"?medium_return@@@@YA?AUMedium@@@@XZ"()
d93 2
a94 2
// WIN32: define dso_local void @@"?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
// WIN64: define dso_local void @@"?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
d98 2
a99 2
// WIN32: define dso_local void @@"?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
// WIN64: define dso_local void @@"?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
d102 1
a102 1
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
d106 2
a107 2
// WIN32: define dso_local void @@"?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)
// WIN64: define dso_local void @@"?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)
d111 3
a113 3
// WIN32: define dso_local void @@"?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WIN64: define dso_local void @@"?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
d118 2
a119 2
// WIN32: define dso_local void @@"?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)
// WIN64: define dso_local void @@"?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)
d124 3
a126 3
// WIN32: define dso_local void @@"?small_arg@@@@YAXUSmall@@@@@@Z"(i32 %s.0)
// WIN64: define dso_local void @@"?small_arg@@@@YAXUSmall@@@@@@Z"(i32 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_arg@@@@YAXUSmall@@@@@@Z"([1 x i32] %s.coerce)
d130 3
a132 3
// WIN32: define dso_local void @@"?medium_arg@@@@YAXUMedium@@@@@@Z"(i32 %s.0, i32 %s.1)
// WIN64: define dso_local void @@"?medium_arg@@@@YAXUMedium@@@@@@Z"(i64 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?medium_arg@@@@YAXUMedium@@@@@@Z"([2 x i32] %s.coerce)
d136 3
a138 3
// WIN32: define dso_local void @@"?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"(i32 %s.0, i32 %s.1)
// WIN64: define dso_local void @@"?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"(i64 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?base_no_byval_arg@@@@YAXUBaseNoByval@@@@@@Z"([2 x i32] %s.coerce)
d142 3
a144 3
// WIN32: define dso_local void @@"?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(i32 %s.0)
// WIN64: define dso_local void @@"?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(i32 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"([1 x i32] %s.coerce)
d149 3
a151 3
// WIN32: define dso_local void @@"?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"(%struct.Multibyte* byval align 4 %s)
// WIN64: define dso_local void @@"?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"(i32 %s.coerce)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?multibyte_arg@@@@YAXUMultibyte@@@@@@Z"([1 x i32] %s.coerce)
d155 2
a156 2
// WIN32: define dso_local void @@"?packed_arg@@@@YAXUPacked@@@@@@Z"(%struct.Packed* byval align 4 %s)
// WIN64: define dso_local void @@"?packed_arg@@@@YAXUPacked@@@@@@Z"(%struct.Packed* %s)
d160 2
a161 2
// WIN32: define dso_local void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(<{ %struct.SmallWithDtor }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d163 2
a164 2
// WIN64: define dso_local void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %s.coerce) {{.*}} {
// WIN64:   call void @@"??1SmallWithDtor@@@@QEAA@@XZ"
d168 2
a169 2
// WOA: define dso_local arm_aapcs_vfpcc void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* %s) {{.*}} {
// WOA:   call arm_aapcs_vfpcc void @@"??1SmallWithDtor@@@@QAA@@XZ"(%struct.SmallWithDtor* %s)
d175 6
a180 3
// WIN64-LABEL: define dso_local void @@"?call_small_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %{{.*}})
d185 2
a186 2
// WIN32: define dso_local void @@"?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* dereferenceable({{[0-9]+}}) %s) {{.*}} {
// WIN32-NOT:   call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d188 1
a188 1
// WIN64-LABEL: define dso_local void @@"?ref_small_arg_with_dtor@@@@YAXAEBUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* dereferenceable({{[0-9]+}}) %s)
d191 2
a192 2
// WIN64-LABEL: define dso_local void @@"?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %s)
// WIN64:   call void @@"??1BigWithDtor@@@@QEAA@@XZ"
d200 4
a203 4
// WIN64-LABEL: define dso_local void @@"?call_big_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.BigWithDtor* @@"??0BigWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %{{.*}})
// WIN64-NOT: call void @@"??1BigWithDtor@@@@QEAA@@XZ"
d210 4
a213 4
// WIN32: define dso_local void @@"?temporary_ref_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"
// WIN32:   call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d222 5
a226 5
// WIN32: define dso_local void @@"?eh_cleanup_arg_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"?takes_two_by_val_with_dtor@@@@YAXUSmallWithDtor@@@@0@@Z"
// WIN32-NOT: call x86_thiscallcc void @@"??1SmallWithDtor@@@@QAE@@XZ"
d231 2
a232 2
// WIN32: define dso_local void @@"?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(<{ %struct.SmallWithVftable }>* inalloca)
// WIN64: define dso_local void @@"?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(%struct.SmallWithVftable* %s)
d236 3
a238 3
// WIN32: define dso_local void @@"?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(<{ %struct.MediumWithCopyCtor }>* inalloca)
// WIN64: define dso_local void @@"?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* %s)
// WOA: define dso_local arm_aapcs_vfpcc void @@"?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* %s)
d242 2
a243 2
// WIN32: define dso_local void @@"?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* byval align 4 %s)
// WIN64: define dso_local void @@"?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* %s)
d253 2
a254 2
// WIN32: define dso_local void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i32* %s.0)
// WIN64: define dso_local void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i64 %s.coerce)
d262 4
a265 4
// WIN32-LABEL: define dso_local void @@"?pass_ref_field@@@@YAXXZ"()
// WIN32: call void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i32* %{{.*}})
// WIN64-LABEL: define dso_local void @@"?pass_ref_field@@@@YAXXZ"()
// WIN64: call void @@"?takes_ref_field@@@@YAXURefField@@@@@@Z"(i64 %{{.*}})
d271 2
a272 2
  // WIN32: define {{.*}} x86_thiscallcc void @@"?thiscall_method_small@@Class@@@@QAE?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
d276 2
a277 2
  // WIN32: define {{.*}} x86_thiscallcc void @@"?thiscall_method_small_with_ctor@@Class@@@@QAE?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_small_with_ctor@@Class@@@@QEAA?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)
d281 2
a282 2
  // WIN32: define {{.*}} void @@"?cdecl_method_small@@Class@@@@QAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?cdecl_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
d286 2
a287 2
  // WIN32: define {{.*}} void @@"?cdecl_method_big@@Class@@@@QAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)
  // WIN64: define linkonce_odr dso_local void @@"?cdecl_method_big@@Class@@@@QEAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)
d291 2
a292 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUEmpty@@@@@@Z"(%class.Class* %this, %struct.Empty* byval align 4 %s)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUEmpty@@@@@@Z"(%class.Class* %this, i8 %s.coerce)
d296 2
a297 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, %struct.EmptyWithCtor* byval align 4 %s)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, i8 %s.coerce)
d301 2
a302 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUSmall@@@@@@Z"(%class.Class* %this, i32 %s.0)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUSmall@@@@@@Z"(%class.Class* %this, i32 %s.coerce)
d306 2
a307 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUSmallWithCtor@@@@@@Z"(%class.Class* %this, i32 %s.0)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUSmallWithCtor@@@@@@Z"(%class.Class* %this, i32 %s.coerce)
d311 2
a312 2
  // WIN32: define {{.*}} void @@"?thiscall_method_arg@@Class@@@@QAEXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* byval align 4 %s)
  // WIN64: define linkonce_odr dso_local void @@"?thiscall_method_arg@@Class@@@@QEAAXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* %s)
d336 2
a337 2
// WIN32: define dso_local void @@"?g@@@@YAXUX@@@@@@Z"(<{ %struct.X, [3 x i8] }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"??1X@@@@QAE@@XZ"(%struct.X* {{.*}})
d342 2
a343 2
// WIN32: define dso_local void @@"?f@@@@YAXXZ"() {{.*}} {
// WIN32-NOT: call {{.*}} @@"??1X@@@@QAE@@XZ"
d365 1
a365 1
// WIN32-LABEL: define dso_local void @@"?bar@@test2@@@@YAXXZ"() {{.*}} {
d370 2
a371 2
// WIN32:   call x86_thiscallcc %"struct.test2::NonTrivial"* @@"??0NonTrivial@@test2@@@@QAE@@XZ"
// WIN32:   call i32 @@"?foo@@test2@@@@YAHUNonTrivial@@1@@UPOD@@1@@@@Z"([[argmem_ty]]* inalloca %argmem)
d387 1
a387 1
// WIN32-LABEL: define dso_local void @@"?foo@@test3@@@@YAXUNonTrivial@@1@@_N@@Z"(<{ %"struct.test3::NonTrivial", i8, [3 x i8] }>* inalloca)
d402 1
a402 1
// WIN32-LABEL: define dso_local void @@"?fn2@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"
d408 1
a408 1
// WIN32:   call void @@llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %[[bc1]], i8* align 4 {{.*}}, i32 4, i1 false)
d413 1
a413 1
// WIN32:   call void @@"?fn1@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"([[argmem_ty]]* inalloca %[[argmem]])
d433 4
a436 4
// WIN32-LABEL: define dso_local x86_thiscallcc void @@"?g@@C@@pr30293@@@@QAEXXZ"(%"struct.pr30293::C"* %this)
// WIN32: call x86_thiscallcc %struct.SmallWithDtor* @@"??0SmallWithDtor@@@@QAE@@XZ"
// WIN32: call void @@"?h@@C@@pr30293@@@@UAAXUSmallWithDtor@@@@@@Z"(<{ i8*, %struct.SmallWithDtor }>* inalloca %{{[^,)]*}})
// WIN32: declare dso_local void @@"?h@@C@@pr30293@@@@UAAXUSmallWithDtor@@@@@@Z"(<{ i8*, %struct.SmallWithDtor }>* inalloca)
d438 2
a439 2
// WIN64-LABEL: define dso_local void @@"?g@@C@@pr30293@@@@QEAAXXZ"(%"struct.pr30293::C"* %this)
// WIN64: declare dso_local void @@"?h@@C@@pr30293@@@@UEAAXUSmallWithDtor@@@@@@Z"(i8*, i32)
@


1.1.1.10
log
@Mark old LLVM instance as dead.
@
text
@@


1.1.1.5.4.1
log
@file microsoft-abi-sret-and-byval.cpp was added on branch tls-maxphys on 2014-08-19 23:47:58 +0000
@
text
@d1 345
@


1.1.1.5.4.2
log
@Rebase to HEAD as of a few days ago.
@
text
@a0 345
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-linux | FileCheck -check-prefix LINUX %s
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN32 %s
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN64 %s

struct Empty {};

struct EmptyWithCtor {
  EmptyWithCtor() {}
};

struct Small {
  int x;
};

// This is a C++11 trivial and standard-layout struct but not a C++03 POD.
struct SmallCpp11NotCpp03Pod : Empty {
  int x;
};

struct SmallWithCtor {
  SmallWithCtor() {}
  int x;
};

struct SmallWithDtor {
  SmallWithDtor();
  ~SmallWithDtor();
  int x;
};

struct SmallWithVftable {
  int x;
  virtual void foo();
};

struct Medium {
  int x, y;
};

struct MediumWithCopyCtor {
  MediumWithCopyCtor();
  MediumWithCopyCtor(const struct MediumWithCopyCtor &);
  int x, y;
};

struct Big {
  int a, b, c, d, e, f;
};

struct BigWithDtor {
  BigWithDtor();
  ~BigWithDtor();
  int a, b, c, d, e, f;
};

// WIN32: declare void @@"{{.*take_bools_and_chars.*}}"
// WIN32:       (<{ i8, [3 x i8], i8, [3 x i8], %struct.SmallWithDtor,
// WIN32:           i8, [3 x i8], i8, [3 x i8], i32, i8, [3 x i8] }>* inalloca)
void take_bools_and_chars(char a, char b, SmallWithDtor c, char d, bool e, int f, bool g);
void call_bools_and_chars() {
  take_bools_and_chars('A', 'B', SmallWithDtor(), 'D', true, 13, false);
}

// Returning structs that fit into a register.
Small small_return() { return Small(); }
// LINUX-LABEL: define void @@_Z12small_returnv(%struct.Small* noalias sret %agg.result)
// WIN32: define i32 @@"\01?small_return@@@@YA?AUSmall@@@@XZ"()
// WIN64: define i32 @@"\01?small_return@@@@YA?AUSmall@@@@XZ"()

Medium medium_return() { return Medium(); }
// LINUX-LABEL: define void @@_Z13medium_returnv(%struct.Medium* noalias sret %agg.result)
// WIN32: define i64 @@"\01?medium_return@@@@YA?AUMedium@@@@XZ"()
// WIN64: define i64 @@"\01?medium_return@@@@YA?AUMedium@@@@XZ"()

// Returning structs that fit into a register but are not POD.
SmallCpp11NotCpp03Pod small_non_pod_return() { return SmallCpp11NotCpp03Pod(); }
// LINUX-LABEL: define void @@_Z20small_non_pod_returnv(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
// WIN32: define void @@"\01?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
// WIN64: define void @@"\01?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)

SmallWithCtor small_with_ctor_return() { return SmallWithCtor(); }
// LINUX-LABEL: define void @@_Z22small_with_ctor_returnv(%struct.SmallWithCtor* noalias sret %agg.result)
// WIN32: define void @@"\01?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
// WIN64: define void @@"\01?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)

SmallWithVftable small_with_vftable_return() { return SmallWithVftable(); }
// LINUX-LABEL: define void @@_Z25small_with_vftable_returnv(%struct.SmallWithVftable* noalias sret %agg.result)
// WIN32: define void @@"\01?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)
// WIN64: define void @@"\01?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)

MediumWithCopyCtor medium_with_copy_ctor_return() { return MediumWithCopyCtor(); }
// LINUX-LABEL: define void @@_Z28medium_with_copy_ctor_returnv(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WIN32: define void @@"\01?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WIN64: define void @@"\01?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)

// Returning a large struct that doesn't fit into a register.
Big big_return() { return Big(); }
// LINUX-LABEL: define void @@_Z10big_returnv(%struct.Big* noalias sret %agg.result)
// WIN32: define void @@"\01?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)
// WIN64: define void @@"\01?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)


void small_arg(Small s) {}
// LINUX-LABEL: define void @@_Z9small_arg5Small(%struct.Small* byval align 4 %s)
// WIN32: define void @@"\01?small_arg@@@@YAXUSmall@@@@@@Z"(%struct.Small* byval align 4 %s)
// WIN64: define void @@"\01?small_arg@@@@YAXUSmall@@@@@@Z"(i32 %s.coerce)

void medium_arg(Medium s) {}
// LINUX-LABEL: define void @@_Z10medium_arg6Medium(%struct.Medium* byval align 4 %s)
// WIN32: define void @@"\01?medium_arg@@@@YAXUMedium@@@@@@Z"(%struct.Medium* byval align 4 %s)
// WIN64: define void @@"\01?medium_arg@@@@YAXUMedium@@@@@@Z"(i64 %s.coerce)

void small_arg_with_ctor(SmallWithCtor s) {}
// LINUX-LABEL: define void @@_Z19small_arg_with_ctor13SmallWithCtor(%struct.SmallWithCtor* byval align 4 %s)
// WIN32: define void @@"\01?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(%struct.SmallWithCtor* byval align 4 %s)
// WIN64: define void @@"\01?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(i32 %s.coerce)

// Test that dtors are invoked in the callee.
void small_arg_with_dtor(SmallWithDtor s) {}
// WIN32: define void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(<{ %struct.SmallWithDtor }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
// WIN32: }
// WIN64: define void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %s.coerce) {{.*}} {
// WIN64:   call void @@"\01??1SmallWithDtor@@@@QEAA@@XZ"
// WIN64: }

void call_small_arg_with_dtor() {
  small_arg_with_dtor(SmallWithDtor());
}
// The temporary is copied, so it's destroyed in the caller as well as the
// callee.
// WIN64-LABEL: define void @@"\01?call_small_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(i32 %{{.*}})
// WIN64:   call void @@"\01??1SmallWithDtor@@@@QEAA@@XZ"
// WIN64:   ret void

// Test that references aren't destroyed in the callee.
void ref_small_arg_with_dtor(const SmallWithDtor &s) { }
// WIN32: define void @@"\01?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* dereferenceable({{[0-9]+}}) %s) {{.*}} {
// WIN32-NOT:   call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
// WIN32: }
// WIN64-LABEL: define void @@"\01?ref_small_arg_with_dtor@@@@YAXAEBUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* dereferenceable({{[0-9]+}}) %s)

void big_arg_with_dtor(BigWithDtor s) {}
// WIN64-LABEL: define void @@"\01?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %s)
// WIN64:   call void @@"\01??1BigWithDtor@@@@QEAA@@XZ"
// WIN64: }

void call_big_arg_with_dtor() {
  big_arg_with_dtor(BigWithDtor());
}
// We can elide the copy of the temporary in the caller, because this object is
// larger than 8 bytes and is passed indirectly.
// WIN64-LABEL: define void @@"\01?call_big_arg_with_dtor@@@@YAXXZ"()
// WIN64:   call %struct.BigWithDtor* @@"\01??0BigWithDtor@@@@QEAA@@XZ"
// WIN64:   call void @@"\01?big_arg_with_dtor@@@@YAXUBigWithDtor@@@@@@Z"(%struct.BigWithDtor* %{{.*}})
// WIN64-NOT: call void @@"\01??1BigWithDtor@@@@QEAA@@XZ"
// WIN64:   ret void

// Test that temporaries passed by reference are destroyed in the caller.
void temporary_ref_with_dtor() {
  ref_small_arg_with_dtor(SmallWithDtor());
}
// WIN32: define void @@"\01?temporary_ref_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"\01?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"
// WIN32:   call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
// WIN32: }

void takes_two_by_val_with_dtor(SmallWithDtor a, SmallWithDtor b);
void eh_cleanup_arg_with_dtor() {
  takes_two_by_val_with_dtor(SmallWithDtor(), SmallWithDtor());
}
//   When exceptions are off, we don't have any cleanups.  See
//   microsoft-abi-exceptions.cpp for these cleanups.
// WIN32: define void @@"\01?eh_cleanup_arg_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"\01?takes_two_by_val_with_dtor@@@@YAXUSmallWithDtor@@@@0@@Z"
// WIN32-NOT: call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
// WIN32: }

void small_arg_with_vftable(SmallWithVftable s) {}
// LINUX-LABEL: define void @@_Z22small_arg_with_vftable16SmallWithVftable(%struct.SmallWithVftable* %s)
// WIN32: define void @@"\01?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(<{ %struct.SmallWithVftable }>* inalloca)
// WIN64: define void @@"\01?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(%struct.SmallWithVftable* %s)

void medium_arg_with_copy_ctor(MediumWithCopyCtor s) {}
// LINUX-LABEL: define void @@_Z25medium_arg_with_copy_ctor18MediumWithCopyCtor(%struct.MediumWithCopyCtor* %s)
// WIN32: define void @@"\01?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(<{ %struct.MediumWithCopyCtor }>* inalloca)
// WIN64: define void @@"\01?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* %s)

void big_arg(Big s) {}
// LINUX-LABEL: define void @@_Z7big_arg3Big(%struct.Big* byval align 4 %s)
// WIN32: define void @@"\01?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* byval align 4 %s)
// WIN64: define void @@"\01?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* %s)

class Class {
 public:
  Small thiscall_method_small() { return Small(); }
  // LINUX: define {{.*}} void @@_ZN5Class21thiscall_method_smallEv(%struct.Small* noalias sret %agg.result, %class.Class* %this)
  // WIN32: define {{.*}} x86_thiscallcc void @@"\01?thiscall_method_small@@Class@@@@QAE?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)

  SmallWithCtor thiscall_method_small_with_ctor() { return SmallWithCtor(); }
  // LINUX: define {{.*}} void @@_ZN5Class31thiscall_method_small_with_ctorEv(%struct.SmallWithCtor* noalias sret %agg.result, %class.Class* %this)
  // WIN32: define {{.*}} x86_thiscallcc void @@"\01?thiscall_method_small_with_ctor@@Class@@@@QAE?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_small_with_ctor@@Class@@@@QEAA?AUSmallWithCtor@@@@XZ"(%class.Class* %this, %struct.SmallWithCtor* noalias sret %agg.result)

  Small __cdecl cdecl_method_small() { return Small(); }
  // LINUX: define {{.*}} void @@_ZN5Class18cdecl_method_smallEv(%struct.Small* noalias sret %agg.result, %class.Class* %this)
  // WIN32: define {{.*}} void @@"\01?cdecl_method_small@@Class@@@@QAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?cdecl_method_small@@Class@@@@QEAA?AUSmall@@@@XZ"(%class.Class* %this, %struct.Small* noalias sret %agg.result)

  Big __cdecl cdecl_method_big() { return Big(); }
  // LINUX: define {{.*}} void @@_ZN5Class16cdecl_method_bigEv(%struct.Big* noalias sret %agg.result, %class.Class* %this)
  // WIN32: define {{.*}} void @@"\01?cdecl_method_big@@Class@@@@QAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)
  // WIN64: define linkonce_odr void @@"\01?cdecl_method_big@@Class@@@@QEAA?AUBig@@@@XZ"(%class.Class* %this, %struct.Big* noalias sret %agg.result)

  void thiscall_method_arg(Empty s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE5Empty(%class.Class* %this)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUEmpty@@@@@@Z"(%class.Class* %this, %struct.Empty* byval align 4 %s)
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUEmpty@@@@@@Z"(%class.Class* %this, i8 %s.coerce)

  void thiscall_method_arg(EmptyWithCtor s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE13EmptyWithCtor(%class.Class* %this)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, %struct.EmptyWithCtor* byval align 4 %s)
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, i8 %s.coerce)

  void thiscall_method_arg(Small s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE5Small(%class.Class* %this, %struct.Small* byval align 4 %s)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUSmall@@@@@@Z"(%class.Class* %this, %struct.Small* byval align 4 %s)
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUSmall@@@@@@Z"(%class.Class* %this, i32 %s.coerce)

  void thiscall_method_arg(SmallWithCtor s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE13SmallWithCtor(%class.Class* %this, %struct.SmallWithCtor* byval align 4 %s)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUSmallWithCtor@@@@@@Z"(%class.Class* %this, %struct.SmallWithCtor* byval align 4 %s)
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUSmallWithCtor@@@@@@Z"(%class.Class* %this, i32 %s.coerce)

  void thiscall_method_arg(Big s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE3Big(%class.Class* %this, %struct.Big* byval align 4 %s)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* byval align 4 %s)
  // WIN64: define linkonce_odr void @@"\01?thiscall_method_arg@@Class@@@@QEAAXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* %s)
};

void use_class() {
  Class c;
  c.thiscall_method_small();
  c.thiscall_method_small_with_ctor();

  c.cdecl_method_small();
  c.cdecl_method_big();

  c.thiscall_method_arg(Empty());
  c.thiscall_method_arg(EmptyWithCtor());
  c.thiscall_method_arg(Small());
  c.thiscall_method_arg(SmallWithCtor());
  c.thiscall_method_arg(Big());
}

struct X {
  X();
  ~X();
};
void g(X) {
}
// WIN32: define void @@"\01?g@@@@YAXUX@@@@@@Z"(<{ %struct.X, [3 x i8] }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"\01??1X@@@@QAE@@XZ"(%struct.X* {{.*}})
// WIN32: }
void f() {
  g(X());
}
// WIN32: define void @@"\01?f@@@@YAXXZ"() {{.*}} {
// WIN32-NOT: call {{.*}} @@"\01??1X@@@@QAE@@XZ"
// WIN32: }


namespace test2 {
// We used to crash on this due to the mixture of POD byval and non-trivial
// byval.

struct NonTrivial {
  NonTrivial();
  NonTrivial(const NonTrivial &o);
  ~NonTrivial();
  int a;
};
struct POD { int b; };

int foo(NonTrivial a, POD b);
void bar() {
  POD b;
  b.b = 13;
  int c = foo(NonTrivial(), b);
}
// WIN32-LABEL: define void @@"\01?bar@@test2@@@@YAXXZ"() {{.*}} {
// WIN32:   %[[argmem:[^ ]*]] = alloca inalloca [[argmem_ty:<{ %"struct.test2::NonTrivial", %"struct.test2::POD" }>]]
// WIN32:   getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 1
// WIN32:   call void @@llvm.memcpy
// WIN32:   getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 0
// WIN32:   call x86_thiscallcc %"struct.test2::NonTrivial"* @@"\01??0NonTrivial@@test2@@@@QAE@@XZ"
// WIN32:   call i32 @@"\01?foo@@test2@@@@YAHUNonTrivial@@1@@UPOD@@1@@@@Z"([[argmem_ty]]* inalloca %argmem)
// WIN32:   ret void
// WIN32: }

}

namespace test3 {

// Check that we padded the inalloca struct to a multiple of 4.
struct NonTrivial {
  NonTrivial();
  NonTrivial(const NonTrivial &o);
  ~NonTrivial();
  int a;
};
void foo(NonTrivial a, bool b) { }
// WIN32-LABEL: define void @@"\01?foo@@test3@@@@YAXUNonTrivial@@1@@_N@@Z"(<{ %"struct.test3::NonTrivial", i8, [3 x i8] }>* inalloca)

}

// We would crash here because the later definition of ForwardDeclare1 results
// in a different IR type for the value we want to store.  However, the alloca's
// type will use the argument type selected by fn1.
struct ForwardDeclare1;

typedef void (*FnPtr1)(ForwardDeclare1);
void fn1(FnPtr1 a, SmallWithDtor b) { }

struct ForwardDeclare1 {};

void fn2(FnPtr1 a, SmallWithDtor b) { fn1(a, b); };
// WIN32-LABEL: define void @@"\01?fn2@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"
// WIN32:   %[[a:[^ ]*]] = getelementptr inbounds [[argmem_ty:<{ {}\*, %struct.SmallWithDtor }>]]* %{{.*}}, i32 0, i32 0
// WIN32:   %[[a1:[^ ]*]] = bitcast {}** %[[a]] to void [[dst_ty:\(%struct.ForwardDeclare1\*\)\*]]*
// WIN32:   %[[argmem:[^ ]*]] = alloca inalloca [[argmem_ty]]
// WIN32:   %[[gep1:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 1
// WIN32:   %[[bc1:[^ ]*]] = bitcast %struct.SmallWithDtor* %[[gep1]] to i8*
// WIN32:   call void @@llvm.memcpy.p0i8.p0i8.i32(i8* %[[bc1]], i8* {{.*}}, i32 4, i32 4, i1 false)
// WIN32:   %[[a2:[^ ]*]] = load void [[dst_ty]]* %[[a1]], align 4
// WIN32:   %[[gep2:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 0
// WIN32:   %[[addr:[^ ]*]] = bitcast {}** %[[gep2]] to void [[dst_ty]]*
// WIN32:   store void [[dst_ty]] %[[a2]], void [[dst_ty]]* %[[addr]], align 4
// WIN32:   call void @@"\01?fn1@@@@YAXP6AXUForwardDeclare1@@@@@@ZUSmallWithDtor@@@@@@Z"([[argmem_ty]]* inalloca %[[argmem]])
@


1.1.1.3.4.1
log
@file microsoft-abi-sret-and-byval.cpp was added on branch yamt-pagecache on 2014-05-22 16:18:57 +0000
@
text
@d1 265
@


1.1.1.3.4.2
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@a0 265
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-linux | FileCheck -check-prefix LINUX %s
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN32 %s
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN64 %s

struct Empty {};

struct EmptyWithCtor {
  EmptyWithCtor() {}
};

struct Small {
  int x;
};

// This is a C++11 trivial and standard-layout struct but not a C++03 POD.
struct SmallCpp11NotCpp03Pod : Empty {
  int x;
};

struct SmallWithCtor {
  SmallWithCtor() {}
  int x;
};

struct SmallWithDtor {
  SmallWithDtor();
  ~SmallWithDtor();
  int x;
};

struct SmallWithVftable {
  int x;
  virtual void foo();
};

struct Medium {
  int x, y;
};

struct MediumWithCopyCtor {
  MediumWithCopyCtor();
  MediumWithCopyCtor(const struct MediumWithCopyCtor &);
  int x, y;
};

struct Big {
  int a, b, c, d, e, f;
};

// WIN32: declare void @@"{{.*take_bools_and_chars.*}}"
// WIN32:       (<{ i8, [3 x i8], i8, [3 x i8], %struct.SmallWithDtor,
// WIN32:           i8, [3 x i8], i8, [3 x i8], i32, i8 }>* inalloca)
void take_bools_and_chars(char a, char b, SmallWithDtor c, char d, bool e, int f, bool g);
void call_bools_and_chars() {
  take_bools_and_chars('A', 'B', SmallWithDtor(), 'D', true, 13, false);
}

// Returning structs that fit into a register.
Small small_return() { return Small(); }
// LINUX-LABEL: define void @@_Z12small_returnv(%struct.Small* noalias sret %agg.result)
// WIN32: define i32 @@"\01?small_return@@@@YA?AUSmall@@@@XZ"()
// WIN64: define i32 @@"\01?small_return@@@@YA?AUSmall@@@@XZ"()

Medium medium_return() { return Medium(); }
// LINUX-LABEL: define void @@_Z13medium_returnv(%struct.Medium* noalias sret %agg.result)
// WIN32: define i64 @@"\01?medium_return@@@@YA?AUMedium@@@@XZ"()
// WIN64: define i64 @@"\01?medium_return@@@@YA?AUMedium@@@@XZ"()

// Returning structs that fit into a register but are not POD.
SmallCpp11NotCpp03Pod small_non_pod_return() { return SmallCpp11NotCpp03Pod(); }
// LINUX-LABEL: define void @@_Z20small_non_pod_returnv(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
// WIN32: define void @@"\01?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)
// WIN64: define void @@"\01?small_non_pod_return@@@@YA?AUSmallCpp11NotCpp03Pod@@@@XZ"(%struct.SmallCpp11NotCpp03Pod* noalias sret %agg.result)

SmallWithCtor small_with_ctor_return() { return SmallWithCtor(); }
// LINUX-LABEL: define void @@_Z22small_with_ctor_returnv(%struct.SmallWithCtor* noalias sret %agg.result)
// WIN32: define void @@"\01?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)
// WIN64: define void @@"\01?small_with_ctor_return@@@@YA?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result)

SmallWithVftable small_with_vftable_return() { return SmallWithVftable(); }
// LINUX-LABEL: define void @@_Z25small_with_vftable_returnv(%struct.SmallWithVftable* noalias sret %agg.result)
// WIN32: define void @@"\01?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)
// WIN64: define void @@"\01?small_with_vftable_return@@@@YA?AUSmallWithVftable@@@@XZ"(%struct.SmallWithVftable* noalias sret %agg.result)

MediumWithCopyCtor medium_with_copy_ctor_return() { return MediumWithCopyCtor(); }
// LINUX-LABEL: define void @@_Z28medium_with_copy_ctor_returnv(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WIN32: define void @@"\01?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)
// WIN64: define void @@"\01?medium_with_copy_ctor_return@@@@YA?AUMediumWithCopyCtor@@@@XZ"(%struct.MediumWithCopyCtor* noalias sret %agg.result)

// Returning a large struct that doesn't fit into a register.
Big big_return() { return Big(); }
// LINUX-LABEL: define void @@_Z10big_returnv(%struct.Big* noalias sret %agg.result)
// WIN32: define void @@"\01?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)
// WIN64: define void @@"\01?big_return@@@@YA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result)


void small_arg(Small s) {}
// LINUX-LABEL: define void @@_Z9small_arg5Small(%struct.Small* byval align 4 %s)
// WIN32: define void @@"\01?small_arg@@@@YAXUSmall@@@@@@Z"(%struct.Small* byval align 4 %s)
// WIN64: define void @@"\01?small_arg@@@@YAXUSmall@@@@@@Z"(i32 %s.coerce)

void medium_arg(Medium s) {}
// LINUX-LABEL: define void @@_Z10medium_arg6Medium(%struct.Medium* byval align 4 %s)
// WIN32: define void @@"\01?medium_arg@@@@YAXUMedium@@@@@@Z"(%struct.Medium* byval align 4 %s)
// WIN64: define void @@"\01?medium_arg@@@@YAXUMedium@@@@@@Z"(i64 %s.coerce)

void small_arg_with_ctor(SmallWithCtor s) {}
// LINUX-LABEL: define void @@_Z19small_arg_with_ctor13SmallWithCtor(%struct.SmallWithCtor* byval align 4 %s)
// WIN32: define void @@"\01?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(%struct.SmallWithCtor* byval align 4 %s)
// WIN64: define void @@"\01?small_arg_with_ctor@@@@YAXUSmallWithCtor@@@@@@Z"(i32 %s.coerce)

// Test that dtors are invoked in the callee.
void small_arg_with_dtor(SmallWithDtor s) {}
// WIN32: define void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(<{ %struct.SmallWithDtor }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
// WIN32: }
// WIN64: define void @@"\01?small_arg_with_dtor@@@@YAXUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* %s) {{.*}} {
// WIN64:   call void @@"\01??1SmallWithDtor@@@@QEAA@@XZ"
// WIN64: }

// Test that references aren't destroyed in the callee.
void ref_small_arg_with_dtor(const SmallWithDtor &s) { }
// WIN32: define void @@"\01?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"(%struct.SmallWithDtor* %s) {{.*}} {
// WIN32-NOT:   call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
// WIN32: }

// Test that temporaries passed by reference are destroyed in the caller.
void temporary_ref_with_dtor() {
  ref_small_arg_with_dtor(SmallWithDtor());
}
// WIN32: define void @@"\01?temporary_ref_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"\01?ref_small_arg_with_dtor@@@@YAXABUSmallWithDtor@@@@@@Z"
// WIN32:   call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
// WIN32: }

void takes_two_by_val_with_dtor(SmallWithDtor a, SmallWithDtor b);
void eh_cleanup_arg_with_dtor() {
  takes_two_by_val_with_dtor(SmallWithDtor(), SmallWithDtor());
}
//   When exceptions are off, we don't have any cleanups.  See
//   microsoft-abi-exceptions.cpp for these cleanups.
// WIN32: define void @@"\01?eh_cleanup_arg_with_dtor@@@@YAXXZ"() {{.*}} {
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call x86_thiscallcc %struct.SmallWithDtor* @@"\01??0SmallWithDtor@@@@QAE@@XZ"
// WIN32:   call void @@"\01?takes_two_by_val_with_dtor@@@@YAXUSmallWithDtor@@@@0@@Z"
// WIN32-NOT: call x86_thiscallcc void @@"\01??1SmallWithDtor@@@@QAE@@XZ"
// WIN32: }

void small_arg_with_vftable(SmallWithVftable s) {}
// LINUX-LABEL: define void @@_Z22small_arg_with_vftable16SmallWithVftable(%struct.SmallWithVftable* %s)
// WIN32: define void @@"\01?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(<{ %struct.SmallWithVftable }>* inalloca)
// WIN64: define void @@"\01?small_arg_with_vftable@@@@YAXUSmallWithVftable@@@@@@Z"(%struct.SmallWithVftable* %s)

void medium_arg_with_copy_ctor(MediumWithCopyCtor s) {}
// LINUX-LABEL: define void @@_Z25medium_arg_with_copy_ctor18MediumWithCopyCtor(%struct.MediumWithCopyCtor* %s)
// WIN32: define void @@"\01?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(<{ %struct.MediumWithCopyCtor }>* inalloca)
// WIN64: define void @@"\01?medium_arg_with_copy_ctor@@@@YAXUMediumWithCopyCtor@@@@@@Z"(%struct.MediumWithCopyCtor* %s)

void big_arg(Big s) {}
// LINUX-LABEL: define void @@_Z7big_arg3Big(%struct.Big* byval align 4 %s)
// WIN32: define void @@"\01?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* byval align 4 %s)
// WIN64: define void @@"\01?big_arg@@@@YAXUBig@@@@@@Z"(%struct.Big* %s)

// FIXME: Add WIN64 tests. Currently, even the method manglings are wrong (sic!).
class Class {
 public:
  Small thiscall_method_small() { return Small(); }
  // LINUX: define {{.*}} void @@_ZN5Class21thiscall_method_smallEv(%struct.Small* noalias sret %agg.result, %class.Class* %this)
  // WIN32: define {{.*}} x86_thiscallcc void @@"\01?thiscall_method_small@@Class@@@@QAE?AUSmall@@@@XZ"(%struct.Small* noalias sret %agg.result, %class.Class* %this)

  SmallWithCtor thiscall_method_small_with_ctor() { return SmallWithCtor(); }
  // LINUX: define {{.*}} void @@_ZN5Class31thiscall_method_small_with_ctorEv(%struct.SmallWithCtor* noalias sret %agg.result, %class.Class* %this)
  // WIN32: define {{.*}} x86_thiscallcc void @@"\01?thiscall_method_small_with_ctor@@Class@@@@QAE?AUSmallWithCtor@@@@XZ"(%struct.SmallWithCtor* noalias sret %agg.result, %class.Class* %this)

  Small __cdecl cdecl_method_small() { return Small(); }
  // LINUX: define {{.*}} void @@_ZN5Class18cdecl_method_smallEv(%struct.Small* noalias sret %agg.result, %class.Class* %this)
  // WIN32: define {{.*}} void @@"\01?cdecl_method_small@@Class@@@@QAA?AUSmall@@@@XZ"(%struct.Small* noalias sret %agg.result, %class.Class* %this)

  Big __cdecl cdecl_method_big() { return Big(); }
  // LINUX: define {{.*}} void @@_ZN5Class16cdecl_method_bigEv(%struct.Big* noalias sret %agg.result, %class.Class* %this)
  // WIN32: define {{.*}} void @@"\01?cdecl_method_big@@Class@@@@QAA?AUBig@@@@XZ"(%struct.Big* noalias sret %agg.result, %class.Class* %this)

  void thiscall_method_arg(Empty s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE5Empty(%class.Class* %this)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUEmpty@@@@@@Z"(%class.Class* %this, %struct.Empty* byval align 4 %s)

  void thiscall_method_arg(EmptyWithCtor s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE13EmptyWithCtor(%class.Class* %this)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUEmptyWithCtor@@@@@@Z"(%class.Class* %this, %struct.EmptyWithCtor* byval align 4 %s)

  void thiscall_method_arg(Small s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE5Small(%class.Class* %this, %struct.Small* byval align 4 %s)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUSmall@@@@@@Z"(%class.Class* %this, %struct.Small* byval align 4 %s)

  void thiscall_method_arg(SmallWithCtor s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE13SmallWithCtor(%class.Class* %this, %struct.SmallWithCtor* byval align 4 %s)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUSmallWithCtor@@@@@@Z"(%class.Class* %this, %struct.SmallWithCtor* byval align 4 %s)

  void thiscall_method_arg(Big s) {}
  // LINUX: define {{.*}} void @@_ZN5Class19thiscall_method_argE3Big(%class.Class* %this, %struct.Big* byval align 4 %s)
  // WIN32: define {{.*}} void @@"\01?thiscall_method_arg@@Class@@@@QAEXUBig@@@@@@Z"(%class.Class* %this, %struct.Big* byval align 4 %s)
};

void use_class() {
  Class c;
  c.thiscall_method_small();
  c.thiscall_method_small_with_ctor();

  c.cdecl_method_small();
  c.cdecl_method_big();

  c.thiscall_method_arg(Empty());
  c.thiscall_method_arg(EmptyWithCtor());
  c.thiscall_method_arg(Small());
  c.thiscall_method_arg(SmallWithCtor());
  c.thiscall_method_arg(Big());
}

struct X {
  X();
  ~X();
};
void g(X) {
}
// WIN32: define void @@"\01?g@@@@YAXUX@@@@@@Z"(<{ %struct.X }>* inalloca) {{.*}} {
// WIN32:   call x86_thiscallcc void @@"\01??1X@@@@QAE@@XZ"(%struct.X* {{.*}})
// WIN32: }
void f() {
  g(X());
}
// WIN32: define void @@"\01?f@@@@YAXXZ"() {{.*}} {
// WIN32-NOT: call {{.*}} @@"\01??1X@@@@QAE@@XZ"
// WIN32: }


namespace test2 {
// We used to crash on this due to the mixture of POD byval and non-trivial
// byval.

struct NonTrivial {
  NonTrivial();
  NonTrivial(const NonTrivial &o);
  ~NonTrivial();
  int a;
};
struct POD { int b; };

int foo(NonTrivial a, POD b);
void bar() {
  POD b;
  b.b = 13;
  int c = foo(NonTrivial(), b);
}
// WIN32-LABEL: define void @@"\01?bar@@test2@@@@YAXXZ"() {{.*}} {
// WIN32:   %[[argmem:[^ ]*]] = alloca [[argmem_ty:<{ %"struct.test2::NonTrivial", %"struct.test2::POD" }>]], inalloca
// WIN32:   getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 1
// WIN32:   call void @@llvm.memcpy
// WIN32:   getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 0
// WIN32:   call x86_thiscallcc %"struct.test2::NonTrivial"* @@"\01??0NonTrivial@@test2@@@@QAE@@XZ"
// WIN32:   call i32 @@"\01?foo@@test2@@@@YAHUNonTrivial@@1@@UPOD@@1@@@@Z"([[argmem_ty]]* inalloca %argmem)
// WIN32:   ret void
// WIN32: }

}
@


