mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-06 10:57:35 +03:00
LLVM15: fix tests for LLVM15 and opaque pointers (#4252)
This commit is contained in:
parent
fed90e8993
commit
62bcb9854b
18 changed files with 100 additions and 51 deletions
|
@ -1215,9 +1215,10 @@ void DtoDefineFunction(FuncDeclaration *fd, bool linkageAvailableExternally) {
|
||||||
|
|
||||||
// function attributes
|
// function attributes
|
||||||
if (gABI->needsUnwindTables()) {
|
if (gABI->needsUnwindTables()) {
|
||||||
func->addFnAttr(LLAttribute::UWTable);
|
|
||||||
#if LDC_LLVM_VER >= 1500
|
#if LDC_LLVM_VER >= 1500
|
||||||
func->setUWTableKind(llvm::UWTableKind::Default);
|
func->setUWTableKind(llvm::UWTableKind::Default);
|
||||||
|
#else
|
||||||
|
func->addFnAttr(LLAttribute::UWTable);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (opts::isAnySanitizerEnabled() &&
|
if (opts::isAnySanitizerEnabled() &&
|
||||||
|
|
|
@ -272,9 +272,10 @@ struct LazyFunctionDeclarer {
|
||||||
// FIXME: Move to better place (abi-x86-64.cpp?)
|
// FIXME: Move to better place (abi-x86-64.cpp?)
|
||||||
// NOTE: There are several occurances if this line.
|
// NOTE: There are several occurances if this line.
|
||||||
if (global.params.targetTriple->getArch() == llvm::Triple::x86_64) {
|
if (global.params.targetTriple->getArch() == llvm::Triple::x86_64) {
|
||||||
fn->addFnAttr(LLAttribute::UWTable);
|
|
||||||
#if LDC_LLVM_VER >= 1500
|
#if LDC_LLVM_VER >= 1500
|
||||||
fn->setUWTableKind(llvm::UWTableKind::Default);
|
fn->setUWTableKind(llvm::UWTableKind::Default);
|
||||||
|
#else
|
||||||
|
fn->addFnAttr(LLAttribute::UWTable);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ extern(C): // simplify name mangling for simpler string matching
|
||||||
|
|
||||||
// PROFGEN-LABEL: @for_loop()
|
// PROFGEN-LABEL: @for_loop()
|
||||||
// PROFUSE-LABEL: @for_loop()
|
// PROFUSE-LABEL: @for_loop()
|
||||||
// PROFGEN: store {{.*}} @[[FL]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[FL]]
|
||||||
// PROFUSE-SAME: !prof ![[FL0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[FL0:[0-9]+]]
|
||||||
void for_loop() {
|
void for_loop() {
|
||||||
uint i;
|
uint i;
|
||||||
|
@ -63,7 +63,7 @@ void for_loop() {
|
||||||
|
|
||||||
// PROFGEN-LABEL: @foreach_loop()
|
// PROFGEN-LABEL: @foreach_loop()
|
||||||
// PROFUSE-LABEL: @foreach_loop()
|
// PROFUSE-LABEL: @foreach_loop()
|
||||||
// PROFGEN: store {{.*}} @[[FEL]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[FEL]]
|
||||||
// PROFUSE-SAME: !prof ![[FEL0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[FEL0:[0-9]+]]
|
||||||
void foreach_loop() {
|
void foreach_loop() {
|
||||||
// PROFGEN: store {{.*}} @[[FEL]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[FEL]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
|
@ -88,7 +88,7 @@ void foreach_loop() {
|
||||||
|
|
||||||
// PROFGEN-LABEL: @foreachrange_loop()
|
// PROFGEN-LABEL: @foreachrange_loop()
|
||||||
// PROFUSE-LABEL: @foreachrange_loop()
|
// PROFUSE-LABEL: @foreachrange_loop()
|
||||||
// PROFGEN: store {{.*}} @[[FERL]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[FERL]]
|
||||||
// PROFUSE-SAME: !prof ![[FERL0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[FERL0:[0-9]+]]
|
||||||
void foreachrange_loop() {
|
void foreachrange_loop() {
|
||||||
import std.range : iota;
|
import std.range : iota;
|
||||||
|
@ -118,7 +118,7 @@ void foreachrange_loop() {
|
||||||
|
|
||||||
// PROFGEN-LABEL: @label_goto()
|
// PROFGEN-LABEL: @label_goto()
|
||||||
// PROFUSE-LABEL: @label_goto()
|
// PROFUSE-LABEL: @label_goto()
|
||||||
// PROFGEN: store {{.*}} @[[LG]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[LG]]
|
||||||
// PROFUSE-SAME: !prof ![[LG0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[LG0:[0-9]+]]
|
||||||
void label_goto() {
|
void label_goto() {
|
||||||
int i = 0; // 1x
|
int i = 0; // 1x
|
||||||
|
@ -149,7 +149,7 @@ emptylabel: // 1x
|
||||||
|
|
||||||
// PROFGEN-LABEL: @c_switches()
|
// PROFGEN-LABEL: @c_switches()
|
||||||
// PROFUSE-LABEL: @c_switches()
|
// PROFUSE-LABEL: @c_switches()
|
||||||
// PROFGEN: store {{.*}} @[[SWC]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[SWC]]
|
||||||
// PROFUSE-SAME: !prof ![[SW0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[SW0:[0-9]+]]
|
||||||
void c_switches() {
|
void c_switches() {
|
||||||
static int[] weights = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5];
|
static int[] weights = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5];
|
||||||
|
@ -238,7 +238,7 @@ void c_switches() {
|
||||||
// test the particulars of switches using D features
|
// test the particulars of switches using D features
|
||||||
// PROFGEN-LABEL: @d_switches()
|
// PROFGEN-LABEL: @d_switches()
|
||||||
// PROFUSE-LABEL: @d_switches()
|
// PROFUSE-LABEL: @d_switches()
|
||||||
// PROFGEN: store {{.*}} @[[DSW]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[DSW]]
|
||||||
// PROFUSE-SAME: !prof ![[DSW0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[DSW0:[0-9]+]]
|
||||||
void d_switches() {
|
void d_switches() {
|
||||||
uint i;
|
uint i;
|
||||||
|
@ -297,7 +297,7 @@ void d_switches() {
|
||||||
|
|
||||||
// PROFGEN-LABEL: @booleanlogic()
|
// PROFGEN-LABEL: @booleanlogic()
|
||||||
// PROFUSE-LABEL: @booleanlogic()
|
// PROFUSE-LABEL: @booleanlogic()
|
||||||
// PROFGEN: store {{.*}} @[[BOOL]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[BOOL]]
|
||||||
// PROFUSE-SAME: !prof ![[BOOL0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[BOOL0:[0-9]+]]
|
||||||
void booleanlogic() {
|
void booleanlogic() {
|
||||||
bool t = true, f = false;
|
bool t = true, f = false;
|
||||||
|
@ -335,7 +335,7 @@ void booleanlogic() {
|
||||||
|
|
||||||
// PROFGEN-LABEL: @do_while()
|
// PROFGEN-LABEL: @do_while()
|
||||||
// PROFUSE-LABEL: @do_while()
|
// PROFUSE-LABEL: @do_while()
|
||||||
// PROFGEN: store {{.*}} @[[DW]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[DW]]
|
||||||
// PROFUSE-SAME: !prof ![[DW0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[DW0:[0-9]+]]
|
||||||
void do_while() {
|
void do_while() {
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
// PROFGEN: @[[MAIN:__(llvm_profile_counters|profc)__Dmain]] ={{.*}} global [1 x i64] zeroinitializer
|
// PROFGEN: @[[MAIN:__(llvm_profile_counters|profc)__Dmain]] ={{.*}} global [1 x i64] zeroinitializer
|
||||||
|
|
||||||
// PROFGEN-LABEL: @_Dmain(
|
// PROFGEN-LABEL: @_Dmain(
|
||||||
// PROFGEN: store {{.*}} @[[MAIN]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[MAIN]]
|
||||||
@safe:
|
@safe:
|
||||||
void main() {
|
void main() {
|
||||||
int[] array = [1,2,3];
|
int[] array = [1,2,3];
|
||||||
|
|
|
@ -16,7 +16,7 @@ extern(C): // simplify name mangling for simpler string matching
|
||||||
|
|
||||||
// PROFGEN-LABEL: @bunch_of_branches(i32
|
// PROFGEN-LABEL: @bunch_of_branches(i32
|
||||||
// PROFUSE-LABEL: @bunch_of_branches(i32
|
// PROFUSE-LABEL: @bunch_of_branches(i32
|
||||||
// PROFGEN: store {{.*}} @[[BoB]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[BoB]]
|
||||||
// PROFUSE-SAME: !prof ![[BoB0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[BoB0:[0-9]+]]
|
||||||
void bunch_of_branches(const uint two) {
|
void bunch_of_branches(const uint two) {
|
||||||
uint i;
|
uint i;
|
||||||
|
|
|
@ -17,7 +17,7 @@ extern(C): // simplify name mangling for simpler string matching
|
||||||
|
|
||||||
// PROFGEN-LABEL: @testbreak({{.*}})
|
// PROFGEN-LABEL: @testbreak({{.*}})
|
||||||
// PROFUSE-LABEL: @testbreak({{.*}})
|
// PROFUSE-LABEL: @testbreak({{.*}})
|
||||||
// PROFGEN: store {{.*}} @[[BREAK]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[BREAK]]
|
||||||
// PROFUSE-SAME: !prof ![[BREAK0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[BREAK0:[0-9]+]]
|
||||||
void testbreak(bool a) {
|
void testbreak(bool a) {
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ outer:
|
||||||
|
|
||||||
// PROFGEN-LABEL: @testcontinue({{.*}})
|
// PROFGEN-LABEL: @testcontinue({{.*}})
|
||||||
// PROFUSE-LABEL: @testcontinue({{.*}})
|
// PROFUSE-LABEL: @testcontinue({{.*}})
|
||||||
// PROFGEN: store {{.*}} @[[CONT]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[CONT]]
|
||||||
// PROFUSE-SAME: !prof ![[CONT0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[CONT0:[0-9]+]]
|
||||||
void testcontinue(bool a) {
|
void testcontinue(bool a) {
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class ExceptionThree : Exception {
|
||||||
|
|
||||||
// PROFGEN-LABEL: @scope_stmts(
|
// PROFGEN-LABEL: @scope_stmts(
|
||||||
// PROFUSE-LABEL: @scope_stmts(
|
// PROFUSE-LABEL: @scope_stmts(
|
||||||
// PROFGEN: store {{.*}} @[[SCP]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[SCP]]
|
||||||
// PROFUSE-SAME: !prof ![[SCP0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[SCP0:[0-9]+]]
|
||||||
void scope_stmts(bool fail) {
|
void scope_stmts(bool fail) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -50,7 +50,7 @@ void scope_stmts(bool fail) {
|
||||||
|
|
||||||
// PROFGEN-LABEL: @try_catch()
|
// PROFGEN-LABEL: @try_catch()
|
||||||
// PROFUSE-LABEL: @try_catch()
|
// PROFUSE-LABEL: @try_catch()
|
||||||
// PROFGEN: store {{.*}} @[[TC]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[TC]]
|
||||||
// PROFUSE-SAME: !prof ![[TC0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[TC0:[0-9]+]]
|
||||||
void try_catch() {
|
void try_catch() {
|
||||||
// PROFGEN: store {{.*}} @[[TC]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[TC]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
|
@ -110,7 +110,7 @@ void try_catch() {
|
||||||
|
|
||||||
// PROFGEN-LABEL: @try_finally()
|
// PROFGEN-LABEL: @try_finally()
|
||||||
// PROFUSE-LABEL: @try_finally()
|
// PROFUSE-LABEL: @try_finally()
|
||||||
// PROFGEN: store {{.*}} @[[TF]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[TF]]
|
||||||
// PROFUSE-SAME: !prof ![[TF0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[TF0:[0-9]+]]
|
||||||
void try_finally() {
|
void try_finally() {
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}simplefunction{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}simplefunction{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}simplefunction{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}simplefunction{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[SMPL]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[SMPL]]
|
||||||
// PROFUSE-SAME: !prof ![[SMPL0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[SMPL0:[0-9]+]]
|
||||||
void simplefunction(int i) {
|
void simplefunction(int i) {
|
||||||
// PROFGEN: store {{.*}} @[[SMPL]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[SMPL]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
|
@ -43,7 +43,7 @@ void simplefunction(int i) {
|
||||||
|
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}templatefunc{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}templatefunc{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}templatefunc{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}templatefunc{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[TMPL]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[TMPL]]
|
||||||
// PROFUSE-SAME: !prof ![[TMPL0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[TMPL0:[0-9]+]]
|
||||||
void templatefunc(T)(T i) {
|
void templatefunc(T)(T i) {
|
||||||
// PROFGEN: store {{.*}} @[[TMPL]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[TMPL]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
|
@ -59,13 +59,13 @@ void call_templatefunc(int i) {
|
||||||
|
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}outerfunc{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}outerfunc{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}outerfunc{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}outerfunc{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[OUTR]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[OUTR]]
|
||||||
// PROFUSE-SAME: !prof ![[OUTR0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[OUTR0:[0-9]+]]
|
||||||
// PROFGEN: store {{.*}} @[[OUTR]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[OUTR]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
// PROFUSE: br {{.*}} !prof ![[OUTR1:[0-9]+]]
|
// PROFUSE: br {{.*}} !prof ![[OUTR1:[0-9]+]]
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}nestedfunc{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}nestedfunc{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}nestedfunc{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}nestedfunc{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[NEST]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[NEST]]
|
||||||
// PROFUSE-SAME: !prof ![[NEST0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[NEST0:[0-9]+]]
|
||||||
// PROFGEN: store {{.*}} @[[NEST]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[NEST]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
// PROFUSE: br {{.*}} !prof ![[NEST1:[0-9]+]]
|
// PROFUSE: br {{.*}} !prof ![[NEST1:[0-9]+]]
|
||||||
|
@ -83,7 +83,7 @@ void takedelegate(int i, int delegate(int) fd) {
|
||||||
}
|
}
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}testanonymous{{.*}}lambda{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}testanonymous{{.*}}lambda{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}testanonymous{{.*}}lambda{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}testanonymous{{.*}}lambda{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[LMBD]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[LMBD]]
|
||||||
// PROFUSE-SAME: !prof ![[LMBD0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[LMBD0:[0-9]+]]
|
||||||
// PROFGEN: store {{.*}} @[[LMBD]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[LMBD]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
// PROFUSE: br {{.*}} !prof ![[LMBD1:[0-9]+]]
|
// PROFUSE: br {{.*}} !prof ![[LMBD1:[0-9]+]]
|
||||||
|
@ -97,7 +97,7 @@ class Klass {
|
||||||
|
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}Klass{{.*}}__ctor{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}Klass{{.*}}__ctor{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}Klass{{.*}}__ctor{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}Klass{{.*}}__ctor{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[KCTR]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[KCTR]]
|
||||||
// PROFUSE-SAME: !prof ![[KCTR0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[KCTR0:[0-9]+]]
|
||||||
// PROFGEN: store {{.*}} @[[KCTR]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[KCTR]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
// PROFUSE: br {{.*}} !prof ![[KCTR1:[0-9]+]]
|
// PROFUSE: br {{.*}} !prof ![[KCTR1:[0-9]+]]
|
||||||
|
@ -108,7 +108,7 @@ class Klass {
|
||||||
|
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}Klass{{.*}}__dtor{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}Klass{{.*}}__dtor{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}Klass{{.*}}__dtor{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}Klass{{.*}}__dtor{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[KDTR]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[KDTR]]
|
||||||
// PROFUSE-SAME: !prof ![[KDTR0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[KDTR0:[0-9]+]]
|
||||||
// PROFGEN: store {{.*}} @[[KDTR]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[KDTR]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
// PROFUSE: br {{.*}} !prof ![[KDTR1:[0-9]+]]
|
// PROFUSE: br {{.*}} !prof ![[KDTR1:[0-9]+]]
|
||||||
|
@ -118,7 +118,7 @@ class Klass {
|
||||||
|
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}Klass{{.*}}stdmethod{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}Klass{{.*}}stdmethod{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}Klass{{.*}}stdmethod{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}Klass{{.*}}stdmethod{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[KMTH]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[KMTH]]
|
||||||
// PROFUSE-SAME: !prof ![[KMTH0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[KMTH0:[0-9]+]]
|
||||||
// PROFGEN: store {{.*}} @[[KMTH]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[KMTH]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
// PROFUSE: br {{.*}} !prof ![[KMTH1:[0-9]+]]
|
// PROFUSE: br {{.*}} !prof ![[KMTH1:[0-9]+]]
|
||||||
|
@ -128,7 +128,7 @@ class Klass {
|
||||||
|
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}Klass{{.*}}staticmethod{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}Klass{{.*}}staticmethod{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}Klass{{.*}}staticmethod{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}Klass{{.*}}staticmethod{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[KSTC]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[KSTC]]
|
||||||
// PROFUSE-SAME: !prof ![[KSTC0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[KSTC0:[0-9]+]]
|
||||||
// PROFGEN: store {{.*}} @[[KSTC]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[KSTC]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
// PROFUSE: br {{.*}} !prof ![[KSTC1:[0-9]+]]
|
// PROFUSE: br {{.*}} !prof ![[KSTC1:[0-9]+]]
|
||||||
|
@ -143,7 +143,7 @@ struct Strukt {
|
||||||
|
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}__ctor{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}__ctor{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}__ctor{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}__ctor{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[SCTR]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[SCTR]]
|
||||||
// PROFUSE-SAME: !prof ![[SCTR0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[SCTR0:[0-9]+]]
|
||||||
// PROFGEN: store {{.*}} @[[SCTR]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[SCTR]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
// PROFUSE: br {{.*}} !prof ![[SCTR1:[0-9]+]]
|
// PROFUSE: br {{.*}} !prof ![[SCTR1:[0-9]+]]
|
||||||
|
@ -154,7 +154,7 @@ struct Strukt {
|
||||||
|
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}stdmethod{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}stdmethod{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}stdmethod{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}stdmethod{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[SMTH]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[SMTH]]
|
||||||
// PROFUSE-SAME: !prof ![[SMTH0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[SMTH0:[0-9]+]]
|
||||||
// PROFGEN: store {{.*}} @[[SMTH]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[SMTH]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
// PROFUSE: br {{.*}} !prof ![[SMTH1:[0-9]+]]
|
// PROFUSE: br {{.*}} !prof ![[SMTH1:[0-9]+]]
|
||||||
|
@ -164,7 +164,7 @@ struct Strukt {
|
||||||
|
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}__dtor{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}__dtor{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}__dtor{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}Strukt{{.*}}__dtor{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[SDTR]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[SDTR]]
|
||||||
// PROFUSE-SAME: !prof ![[SDTR0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[SDTR0:[0-9]+]]
|
||||||
// PROFGEN: store {{.*}} @[[SDTR]], i{{32|64}} 0, i{{32|64}} 1
|
// PROFGEN: store {{.*}} @[[SDTR]], i{{32|64}} 0, i{{32|64}} 1
|
||||||
// PROFUSE: br {{.*}} !prof ![[SDTR1:[0-9]+]]
|
// PROFUSE: br {{.*}} !prof ![[SDTR1:[0-9]+]]
|
||||||
|
@ -175,7 +175,7 @@ struct Strukt {
|
||||||
|
|
||||||
// PROFGEN-LABEL: define {{.*}} @{{.*}}contractprog{{.*}}(
|
// PROFGEN-LABEL: define {{.*}} @{{.*}}contractprog{{.*}}(
|
||||||
// PROFUSE-LABEL: define {{.*}} @{{.*}}contractprog{{.*}}(
|
// PROFUSE-LABEL: define {{.*}} @{{.*}}contractprog{{.*}}(
|
||||||
// PROFGEN: store {{.*}} @[[CNTR]], i{{32|64}} 0, i{{32|64}} 0
|
// PROFGEN: store {{.*}} @[[CNTR]]
|
||||||
// PROFUSE-SAME: !prof ![[CNTR0:[0-9]+]]
|
// PROFUSE-SAME: !prof ![[CNTR0:[0-9]+]]
|
||||||
void contractprog(int i)
|
void contractprog(int i)
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -50,8 +50,8 @@ int main()
|
||||||
{
|
{
|
||||||
select_func(i);
|
select_func(i);
|
||||||
|
|
||||||
// PROFUSE: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo
|
// PROFUSE: [[REG1:%[0-9]+]] = load {{void \(\)\*, void \(\)\*\*|ptr, ptr}} @foo
|
||||||
// PROFUSE: [[REG2:%[0-9]+]] = icmp eq void ()* [[REG1]], @hot
|
// PROFUSE: [[REG2:%[0-9]+]] = icmp eq {{void \(\)\*|ptr}} [[REG1]], @hot
|
||||||
// PROFUSE: call void @hot()
|
// PROFUSE: call void @hot()
|
||||||
// PROFUSE: call void [[REG1]]()
|
// PROFUSE: call void [[REG1]]()
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// RUN: %ldc -c -output-ll -of=%t.ll %s && FileCheck %s < %t.ll
|
// RUN: %ldc -c -output-ll -of=%t.ll %s && FileCheck %s < %t.ll
|
||||||
|
|
||||||
// CHECK: @llvm.used = appending global {{.*}} @some_function {{.*}} @some_variable
|
// CHECK: @llvm.used = appending global {{.*}} @some_function{{.*}} @some_variable
|
||||||
|
|
||||||
static import ldc.attributes;
|
static import ldc.attributes;
|
||||||
|
|
||||||
|
|
|
@ -3,34 +3,34 @@
|
||||||
@compute(CompileFor.deviceOnly) module dcompute_cu_addrspaces;
|
@compute(CompileFor.deviceOnly) module dcompute_cu_addrspaces;
|
||||||
import ldc.dcompute;
|
import ldc.dcompute;
|
||||||
|
|
||||||
// LL: %"ldc.dcompute.Pointer!(AddrSpace.Private, float).Pointer" = type { float addrspace(5)* }
|
// LL: %"ldc.dcompute.Pointer!(AddrSpace.Private, float).Pointer" = type { {{float addrspace\(5\)\*|ptr addrspace\(5\)}} }
|
||||||
// LL: %"ldc.dcompute.Pointer!(AddrSpace.Global, float).Pointer" = type { float addrspace(1)* }
|
// LL: %"ldc.dcompute.Pointer!(AddrSpace.Global, float).Pointer" = type { {{float addrspace\(1\)\*|ptr addrspace\(1\)}} }
|
||||||
// LL: %"ldc.dcompute.Pointer!(AddrSpace.Shared, float).Pointer" = type { float addrspace(3)* }
|
// LL: %"ldc.dcompute.Pointer!(AddrSpace.Shared, float).Pointer" = type { {{float addrspace\(3\)\*|ptr addrspace\(3\)}} }
|
||||||
// LL: %"ldc.dcompute.Pointer!(AddrSpace.Constant, immutable(float)).Pointer" = type { float addrspace(4)* }
|
// LL: %"ldc.dcompute.Pointer!(AddrSpace.Constant, immutable(float)).Pointer" = type { {{float addrspace\(4\)\*|ptr addrspace\(4\)}} }
|
||||||
// LL: %"ldc.dcompute.Pointer!(AddrSpace.Generic, float).Pointer" = type { float* }
|
// LL: %"ldc.dcompute.Pointer!(AddrSpace.Generic, float).Pointer" = type { {{float\*|ptr}} }
|
||||||
|
|
||||||
void foo(PrivatePointer!float f) {
|
void foo(PrivatePointer!float f) {
|
||||||
// LL: load float, float addrspace(5)*
|
// LL: load float, {{float addrspace\(5\)\*|ptr addrspace\(5\)}}
|
||||||
// PTX: ld.local.f32
|
// PTX: ld.local.f32
|
||||||
float g = *f;
|
float g = *f;
|
||||||
}
|
}
|
||||||
void foo(GlobalPointer!float f) {
|
void foo(GlobalPointer!float f) {
|
||||||
// LL: load float, float addrspace(1)*
|
// LL: load float, {{float addrspace\(1\)\*|ptr addrspace\(1\)}}
|
||||||
// PTX: ld.global.f32
|
// PTX: ld.global.f32
|
||||||
float g = *f;
|
float g = *f;
|
||||||
}
|
}
|
||||||
void foo(SharedPointer!float f) {
|
void foo(SharedPointer!float f) {
|
||||||
// LL: load float, float addrspace(3)*
|
// LL: load float, {{float addrspace\(3\)\*|ptr addrspace\(3\)}}
|
||||||
// PTX: ld.shared.f32
|
// PTX: ld.shared.f32
|
||||||
float g = *f;
|
float g = *f;
|
||||||
}
|
}
|
||||||
void foo(ConstantPointer!float f) {
|
void foo(ConstantPointer!float f) {
|
||||||
// LL: load float, float addrspace(4)*
|
// LL: load float, {{float addrspace\(4\)\*|ptr addrspace\(4\)}}
|
||||||
// PTX: ld.const.f32
|
// PTX: ld.const.f32
|
||||||
float g = *f;
|
float g = *f;
|
||||||
}
|
}
|
||||||
void foo(GenericPointer!float f) {
|
void foo(GenericPointer!float f) {
|
||||||
// LL: load float, float*
|
// LL: load float, {{float\*|ptr}}
|
||||||
// PTX: ld.f32
|
// PTX: ld.f32
|
||||||
float g = *f;
|
float g = *f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
void foo()
|
void foo()
|
||||||
{
|
{
|
||||||
// CHECK: %1 = getelementptr {{.*}}_D6gh28653fooFZv{{.*}} to i8*), i32 -10
|
// CHECK: %1 = getelementptr inbounds i8,{{.*}}_D6gh28653fooFZv{{.*}}, i32 -10
|
||||||
// CHECK-NEXT: %2 = ptrtoint i8* %1 to i{{32|64}}
|
// CHECK-NEXT: %2 = ptrtoint {{i8\*|ptr}} %1 to i{{32|64}}
|
||||||
auto addr = (cast(size_t) &foo) - 10;
|
auto addr = (cast(size_t) &foo) - 10;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// https://github.com/ldc-developers/ldc/issues/3692
|
// https://github.com/ldc-developers/ldc/issues/3692
|
||||||
|
|
||||||
// REQUIRES: target_X86
|
// REQUIRES: target_X86
|
||||||
|
// REQUIRES: atmost_llvm1409
|
||||||
// RUN: %ldc -mtriple=x86_64-linux-gnu -output-ll -of=%t.ll %s
|
// RUN: %ldc -mtriple=x86_64-linux-gnu -output-ll -of=%t.ll %s
|
||||||
// RUN: FileCheck %s < %t.ll
|
// RUN: FileCheck %s < %t.ll
|
||||||
|
|
||||||
|
|
46
tests/codegen/gh3692_llvm15.d
Normal file
46
tests/codegen/gh3692_llvm15.d
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// https://github.com/ldc-developers/ldc/issues/3692
|
||||||
|
|
||||||
|
// REQUIRES: target_X86
|
||||||
|
// REQUIRES: atleast_llvm1500
|
||||||
|
// RUN: %ldc -mtriple=x86_64-linux-gnu -output-ll -of=%t.ll %s
|
||||||
|
// RUN: FileCheck %s < %t.ll
|
||||||
|
|
||||||
|
|
||||||
|
// D `int[3]` rewritten to LL `{ i64, i32 }` for SysV ABI - mismatching size and alignment
|
||||||
|
// CHECK: define void @_D13gh3692_llvm154takeFG3iZv({ i64, i32 } %a_arg)
|
||||||
|
void take(int[3] a)
|
||||||
|
{
|
||||||
|
// the `{ i64, i32 }` size is 16 bytes, so we need a padded alloca (with 8-bytes alignment)
|
||||||
|
// CHECK-NEXT: %a = alloca { i64, i32 }, align 8
|
||||||
|
// CHECK-NEXT: store { i64, i32 } %a_arg, ptr %a
|
||||||
|
}
|
||||||
|
|
||||||
|
// CHECK: define void @_D13gh3692_llvm154passFZv()
|
||||||
|
void pass()
|
||||||
|
{
|
||||||
|
// CHECK-NEXT: %arrayliteral = alloca [3 x i32], align 4
|
||||||
|
// we need an extra padded alloca with proper alignment
|
||||||
|
// CHECK-NEXT: %.BaseBitcastABIRewrite_padded_arg_storage = alloca { i64, i32 }, align 8
|
||||||
|
// CHECK: %.BaseBitcastABIRewrite_arg = load { i64, i32 }, ptr %.BaseBitcastABIRewrite_padded_arg_storage
|
||||||
|
take([1, 2, 3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// D `int[4]` rewritten to LL `{ i64, i64 }` for SysV ABI - mismatching alignment only
|
||||||
|
// CHECK: define void @_D13gh3692_llvm155take4FG4iZv({ i64, i64 } %a_arg)
|
||||||
|
void take4(int[4] a)
|
||||||
|
{
|
||||||
|
// the alloca should have 8-bytes alignment, even though a.alignof == 4
|
||||||
|
// CHECK-NEXT: %a = alloca [4 x i32], align 8
|
||||||
|
// CHECK-NEXT: store { i64, i64 } %a_arg, ptr %a
|
||||||
|
}
|
||||||
|
|
||||||
|
// CHECK: define void @_D13gh3692_llvm155pass4FZv()
|
||||||
|
void pass4()
|
||||||
|
{
|
||||||
|
// CHECK-NEXT: %arrayliteral = alloca [4 x i32], align 4
|
||||||
|
// we need an extra alloca with 8-bytes alignment
|
||||||
|
// CHECK-NEXT: %.BaseBitcastABIRewrite_padded_arg_storage = alloca { i64, i64 }, align 8
|
||||||
|
// CHECK: %.BaseBitcastABIRewrite_arg = load { i64, i64 }, ptr %.BaseBitcastABIRewrite_padded_arg_storage
|
||||||
|
take4([1, 2, 3, 4]);
|
||||||
|
}
|
|
@ -12,7 +12,7 @@ module mod;
|
||||||
// OPT3-LABEL: define {{.*}} @{{.*}}void_three_return_paths
|
// OPT3-LABEL: define {{.*}} @{{.*}}void_three_return_paths
|
||||||
void void_three_return_paths(int a, ...)
|
void void_three_return_paths(int a, ...)
|
||||||
{
|
{
|
||||||
// OPT3: call void @llvm.va_start({{.*}} %[[VA:[0-9]+]])
|
// OPT3: call void @llvm.va_start({{.*}} %[[VA:([0-9]+|_argptr_mem)]])
|
||||||
// OPT3-NOT: return_two
|
// OPT3-NOT: return_two
|
||||||
return_two();
|
return_two();
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ extern int declaredGlobal;
|
||||||
|
|
||||||
// make sure the ModuleInfo ref is emitted into the __minfo section:
|
// make sure the ModuleInfo ref is emitted into the __minfo section:
|
||||||
|
|
||||||
// CHECK: @_D4wasi11__moduleRefZ = linkonce_odr hidden global %object.ModuleInfo* {{.*}}, section "__minfo"
|
// CHECK: @_D4wasi11__moduleRefZ = linkonce_odr hidden global {{%object\.ModuleInfo\*|ptr}} {{.*}}, section "__minfo"
|
||||||
// CHECK: @llvm.used = appending global [1 x {{i8\*|ptr}}] [{{i8\*|ptr}} {{.*}} @_D4wasi11__moduleRefZ
|
// CHECK: @llvm.used = appending global [1 x {{i8\*|ptr}}] [{{i8\*|ptr}} {{.*}}@_D4wasi11__moduleRefZ
|
||||||
|
|
||||||
|
|
||||||
// test the magic linker symbols via linkability of the following:
|
// test the magic linker symbols via linkability of the following:
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
void fun0 () {
|
void fun0 () {
|
||||||
// CHECK-LABEL: define{{.*}} @{{.*}}4fun0FZv
|
// CHECK-LABEL: define{{.*}} @{{.*}}4fun0FZv
|
||||||
// CHECK: [[RET1:%[0-9]]] = call i8* @llvm.returnaddress(i32 0)
|
// CHECK: [[RET1:%[0-9]]] = call {{i8\*|ptr}} @llvm.returnaddress(i32 0)
|
||||||
// CHECK: call void @__cyg_profile_func_enter{{.*}}4fun0FZv{{.*}}[[RET1]]
|
// CHECK: call void @__cyg_profile_func_enter{{.*}}4fun0FZv{{.*}}[[RET1]]
|
||||||
// CHECK: [[RET2:%[0-9]]] = call i8* @llvm.returnaddress(i32 0)
|
// CHECK: [[RET2:%[0-9]]] = call {{i8\*|ptr}} @llvm.returnaddress(i32 0)
|
||||||
// CHECK: call void @__cyg_profile_func_exit{{.*}}4fun0FZv{{.*}}[[RET2]]
|
// CHECK: call void @__cyg_profile_func_exit{{.*}}4fun0FZv{{.*}}[[RET2]]
|
||||||
// CHECK-NEXT: ret
|
// CHECK-NEXT: ret
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -85,7 +85,7 @@ config.available_features.add("llvm%d" % config.llvm_version)
|
||||||
plusoneable_llvmversion = config.llvm_version // 10 + config.llvm_version%10
|
plusoneable_llvmversion = config.llvm_version // 10 + config.llvm_version%10
|
||||||
for version in range(60, plusoneable_llvmversion+1):
|
for version in range(60, plusoneable_llvmversion+1):
|
||||||
config.available_features.add("atleast_llvm%d0%d" % (version//10, version%10))
|
config.available_features.add("atleast_llvm%d0%d" % (version//10, version%10))
|
||||||
for version in range(plusoneable_llvmversion, 141):
|
for version in range(plusoneable_llvmversion, 201):
|
||||||
config.available_features.add("atmost_llvm%d0%d" % (version//10, version%10))
|
config.available_features.add("atmost_llvm%d0%d" % (version//10, version%10))
|
||||||
|
|
||||||
# Define OS as available feature (Windows, Darwin, Linux, FreeBSD...)
|
# Define OS as available feature (Windows, Darwin, Linux, FreeBSD...)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue