[PATCH] D100388: [BROKEN][clang] Try to fix thunk function types
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 14 14:50:14 PDT 2021
lebedev.ri updated this revision to Diff 337567.
lebedev.ri added a comment.
@rsmith thank you for taking a look!
This still feels pretty much like doing it while blindfolded.
I've tried to store `GlobalDecl`, but i'm clearly missing something else, since there are still 23 test failures,
and not all of then are simple tests that need updates.
E.g.:
******************** TEST 'Clang :: CodeGenCXX/debug-info-thunk.cpp' FAILED ********************
Script:
--
: 'RUN: at line 1'; /builddirs/llvm-project/build-Clang11/bin/clang -cc1 -internal-isystem /builddirs/llvm-project/build-Clang11/lib/clang/13.0.0/include -nostdsysteminc /repositories/llvm-project/clang/test/CodeGenCXX/debug-info-thunk.cpp -triple=x86_64-pc-windows-msvc -debug-info-kind=limited -S -emit-llvm -o - | /builddirs/llvm-project/build-Clang11/bin/FileCheck /repositories/llvm-project/clang/test/CodeGenCXX/debug-info-thunk.cpp
: 'RUN: at line 2'; /builddirs/llvm-project/build-Clang11/bin/clang -cc1 -internal-isystem /builddirs/llvm-project/build-Clang11/lib/clang/13.0.0/include -nostdsysteminc /repositories/llvm-project/clang/test/CodeGenCXX/debug-info-thunk.cpp -triple x86_64-unknown-linux-gnu -debug-info-kind=limited -S -emit-llvm -o - | /builddirs/llvm-project/build-Clang11/bin/FileCheck /repositories/llvm-project/clang/test/CodeGenCXX/debug-info-thunk.cpp -check-prefix=ITANIUM
--
Exit Code: 2
Command Output (stderr):
--
clang: /repositories/llvm-project/clang/lib/CodeGen/CGVTables.cpp:518: llvm::Constant *clang::CodeGen::CodeGenVTables::maybeEmitThunk(clang::GlobalDecl, const clang::ThunkInfo &, bool): Assertion `OldThunkFn->isDeclaration() && "Shouldn't replace non-declaration"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /builddirs/llvm-project/build-Clang11/bin/clang -cc1 -internal-isystem /builddirs/llvm-project/build-Clang11/lib/clang/13.0.0/include -nostdsysteminc /repositories/llvm-project/clang/test/CodeGenCXX/debug-info-thunk.cpp -triple=x86_64-pc-windows-msvc -debug-info-kind=limited -S -emit-llvm -o -
1. /repositories/llvm-project/clang/test/CodeGenCXX/debug-info-thunk.cpp:221:1: current parser token 'namespace'
2. /repositories/llvm-project/clang/test/CodeGenCXX/debug-info-thunk.cpp:200:11: LLVM IR generation of declaration 'Test9'
3. /repositories/llvm-project/clang/test/CodeGenCXX/debug-info-thunk.cpp:216:9: Generating code for declaration 'Test9::D::foo1'
#0 0x00007f9f54af2e43 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /repositories/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:13
#1 0x00007f9f54af09a0 llvm::sys::RunSignalHandlers() /repositories/llvm-project/llvm/lib/Support/Signals.cpp:77:18
#2 0x00007f9f54af335f SignalHandler(int) /repositories/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
#3 0x00007f9f597ee140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
#4 0x00007f9f54400ce1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007f9f543ea537 abort ./stdlib/abort.c:81:7
#6 0x00007f9f543ea40f get_sysdep_segment_value ./intl/loadmsgcat.c:509:8
#7 0x00007f9f543ea40f _nl_load_domain ./intl/loadmsgcat.c:970:34
#8 0x00007f9f543f9662 (/lib/x86_64-linux-gnu/libc.so.6+0x34662)
#9 0x00007f9f58958c30 clang::CodeGen::CodeGenVTables::maybeEmitThunk(clang::GlobalDecl, clang::ThunkInfo const&, bool) /repositories/llvm-project/clang/lib/CodeGen/CGVTables.cpp:0:0
********************
FAIL: Clang :: CodeGenCXX/thunks.cpp (29 of 1127)
******************** TEST 'Clang :: CodeGenCXX/thunks.cpp' FAILED ********************
Script:
--
: 'RUN: at line 3'; /builddirs/llvm-project/build-Clang11/bin/clang -cc1 -internal-isystem /builddirs/llvm-project/build-Clang11/lib/clang/13.0.0/include -nostdsysteminc /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp -triple=sparc64-pc-linux-gnu -munwind-tables -emit-llvm -o - | /builddirs/llvm-project/build-Clang11/bin/FileCheck --check-prefixes=CHECK,CHECK-CLONE,CHECK-NONOPT /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp
: 'RUN: at line 5'; /builddirs/llvm-project/build-Clang11/bin/clang -cc1 -internal-isystem /builddirs/llvm-project/build-Clang11/lib/clang/13.0.0/include -nostdsysteminc /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp -triple=sparc64-pc-linux-gnu -debug-info-kind=standalone -dwarf-version=5 -munwind-tables -emit-llvm -o - | /builddirs/llvm-project/build-Clang11/bin/FileCheck --check-prefixes=CHECK,CHECK-CLONE,CHECK-NONOPT,CHECK-DBG /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp
: 'RUN: at line 7'; /builddirs/llvm-project/build-Clang11/bin/clang -cc1 -internal-isystem /builddirs/llvm-project/build-Clang11/lib/clang/13.0.0/include -nostdsysteminc /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp -triple=sparc64-pc-linux-gnu -munwind-tables -emit-llvm -o - -O1 -disable-llvm-passes | /builddirs/llvm-project/build-Clang11/bin/FileCheck --check-prefixes=CHECK,CHECK-CLONE,CHECK-OPT /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp
: 'RUN: at line 11'; /builddirs/llvm-project/build-Clang11/bin/clang -cc1 -internal-isystem /builddirs/llvm-project/build-Clang11/lib/clang/13.0.0/include -nostdsysteminc /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp -triple=x86_64-pc-linux-gnu -munwind-tables -emit-llvm -o - -O1 -disable-llvm-passes | /builddirs/llvm-project/build-Clang11/bin/FileCheck --check-prefixes=CHECK,CHECK-TAIL,CHECK-OPT /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp
: 'RUN: at line 15'; /builddirs/llvm-project/build-Clang11/bin/clang -cc1 -internal-isystem /builddirs/llvm-project/build-Clang11/lib/clang/13.0.0/include -nostdsysteminc /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp -triple=x86_64-windows-msvc -munwind-tables -emit-llvm -o - -O1 -disable-llvm-passes | /builddirs/llvm-project/build-Clang11/bin/FileCheck --check-prefixes=WIN64 /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp
--
Exit Code: 2
Command Output (stderr):
--
clang: /repositories/llvm-project/llvm/lib/IR/Value.cpp:500: void llvm::Value::doRAUW(llvm::Value *, llvm::Value::ReplaceMetadataUses): Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /builddirs/llvm-project/build-Clang11/bin/clang -cc1 -internal-isystem /builddirs/llvm-project/build-Clang11/lib/clang/13.0.0/include -nostdsysteminc /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp -triple=sparc64-pc-linux-gnu -munwind-tables -emit-llvm -o -
1. /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp:390:1: current parser token 'namespace'
2. /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp:342:11: LLVM IR generation of declaration 'Test12'
3. /repositories/llvm-project/clang/test/CodeGenCXX/thunks.cpp:354:9: Generating code for declaration 'Test12::C::f'
#0 0x00007ff8c7c7ae43 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /repositories/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:13
#1 0x00007ff8c7c789a0 llvm::sys::RunSignalHandlers() /repositories/llvm-project/llvm/lib/Support/Signals.cpp:77:18
#2 0x00007ff8c7c7b35f SignalHandler(int) /repositories/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
#3 0x00007ff8cc976140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
#4 0x00007ff8c7588ce1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007ff8c7572537 abort ./stdlib/abort.c:81:7
#6 0x00007ff8c757240f get_sysdep_segment_value ./intl/loadmsgcat.c:509:8
#7 0x00007ff8c757240f _nl_load_domain ./intl/loadmsgcat.c:970:34
#8 0x00007ff8c7581662 (/lib/x86_64-linux-gnu/libc.so.6+0x34662)
#9 0x00007ff8c825b8d5 llvm::cast_retty<llvm::BasicBlock, llvm::Value*>::ret_type llvm::cast<llvm::BasicBlock, llvm::Value>(llvm::Value*) /repositories/llvm-project/llvm/include/llvm/Support/Casting.h:269:3
#10 0x00007ff8c825b8d5 llvm::Value::doRAUW(llvm::Value*, llvm::Value::ReplaceMetadataUses) /repositories/llvm-project/llvm/lib/IR/Value.cpp:523:38
#11 0x00007ff8cbade0fb clang::CodeGen::CodeGenFunction::GenerateVarArgsThunk(llvm::Function*, clang::CodeGen::CGFunctionInfo const&, clang::GlobalDecl, llvm::FunctionCallee, clang::ThunkInfo const&) /repositories/llvm-project/clang/lib/CodeGen/CGVTables.cpp:184:10
#12 0x00007ff8cbae0a0f clang::CodeGen::CodeGenVTables::maybeEmitThunk(clang::GlobalDecl, clang::ThunkInfo const&, bool) /repositories/llvm-project/clang/lib/CodeGen/CGVTables.cpp:584:36
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100388/new/
https://reviews.llvm.org/D100388
Files:
clang/include/clang/AST/VTableBuilder.h
clang/include/clang/Basic/ABI.h
clang/include/clang/Basic/Thunk.h
clang/lib/AST/ItaniumMangle.cpp
clang/lib/AST/MicrosoftMangle.cpp
clang/lib/AST/VTableBuilder.cpp
clang/lib/CodeGen/CGVTables.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/test/CodeGenCXX/thunk-linkonce-odr.cpp
clang/test/CodeGenCXX/thunk-returning-memptr.cpp
clang/test/CodeGenCXX/thunk-wrong-return-type.cpp
clang/test/CodeGenCXX/thunk-wrong-this.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100388.337567.patch
Type: text/x-patch
Size: 35560 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210414/50773ad0/attachment-0001.bin>
More information about the llvm-commits
mailing list