[llvm-bugs] [Bug 42489] New: Instruction selection error on asm-goto statement
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jul 2 07:59:12 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42489
Bug ID: 42489
Summary: Instruction selection error on asm-goto statement
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: glider at google.com
CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, spatel+llvm at rotateright.com
The following sample is a creduce-d piece of Android kernel:
$ cat rotator.i
d() {
for (int e = 0; e < 3; e++)
if (e) {
_Bool branch = 0;
int *f = 0;
asm goto("1: nop\n\t.quad b, %l[l_yes], %c0\n\t"
:
: "i"(&f[branch])
:
: l_yes);
l_yes:
g();
}
}
Compiling it with GCC works just fine:
$ gcc -g -w -o rotator.o rotator.i -fno-pie -c -O2
(note that neither GCC nor Clang can compile it with -O0 - this probably has
something to do with loop unrolling)
whereas Clang crashes on instruction selection:
$ clang -no-integrated-as -g -w -o rotator.o rotator.i -c -fno-pie -O2
clang-9:
/usr/local/google/src/llvm-git-monorepo/llvm/include/llvm/Support/Casting.h:264:
typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
llvm::BlockAddress; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type
= llvm::BlockAddress*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
Stack dump:
0. Program arguments:
/usr/local/google/src/llvm-git-monorepo/llvm_cmake_build/bin/clang-9 -cc1
-triple x86_64-unknown-linux-gnu -S -disable-free -main-file-name rotator.i
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-no-integrated-as -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -debug-info-kind=limited -dwarf-version=4
-debugger-tuning=gdb -momit-leaf-frame-pointer -coverage-notes-file
/usr/local/google/src/kernel-bonito-new/out/android-msm-pixel-4.9/private/msm-google/rotator.gcno
-resource-dir
/usr/local/google/src/llvm-git-monorepo/llvm_cmake_build/lib/clang/9.0.0 -O2 -w
-fno-dwarf-directory-asm -fdebug-compilation-dir
/usr/local/google/src/kernel-bonito-new/out/android-msm-pixel-4.9/private/msm-google
-ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/rotator-804c16.s -x cpp-output rotator.i
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'rotator.i'.
4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@d'
#0 0x000056287f64a17a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/google/src/llvm-git-monorepo/llvm_cmake_build/bin/clang-9+0x2b0e17a)
#1 0x000056287f647fa4 llvm::sys::RunSignalHandlers()
(/usr/local/google/src/llvm-git-monorepo/llvm_cmake_build/bin/clang-9+0x2b0bfa4)
#2 0x000056287f6480d2 SignalHandler(int)
(/usr/local/google/src/llvm-git-monorepo/llvm_cmake_build/bin/clang-9+0x2b0c0d2)
#3 0x00007f52f79713a0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x123a0)
#4 0x00007f52f6462cfb raise (/lib/x86_64-linux-gnu/libc.so.6+0x36cfb)
#5 0x00007f52f644d8ad abort (/lib/x86_64-linux-gnu/libc.so.6+0x218ad)
#6 0x00007f52f644d77f (/lib/x86_64-linux-gnu/libc.so.6+0x2177f)
#7 0x00007f52f645b542 (/lib/x86_64-linux-gnu/libc.so.6+0x2f542)
#8 0x000056288011dcae
llvm::SelectionDAGBuilder::visitInlineAsm(llvm::ImmutableCallSite)
(/usr/local/google/src/llvm-git-monorepo/llvm_cmake_build/bin/clang-9+0x35e1cae)
#9 0x000056288011e067 llvm::SelectionDAGBuilder::visitCallBr(llvm::CallBrInst
const&)
(/usr/local/google/src/llvm-git-monorepo/llvm_cmake_build/bin/clang-9+0x35e2067)
#10 0x0000562880131e5f llvm::SelectionDAGBuilder::visit(llvm::Instruction
const&)
(/usr/local/google/src/llvm-git-monorepo/llvm_cmake_build/bin/clang-9+0x35f5e5f)
Note that the same problem is reproducible with --target=aarch64-linux-gnu, so
it's not X86-specific
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190702/402c5404/attachment-0001.html>
More information about the llvm-bugs
mailing list