Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Cannot emit physreg copy instruction #37518

Open Quuxplusone opened 6 years ago

Quuxplusone commented 6 years ago
Bugzilla Link PR38545
Status NEW
Importance P enhancement
Reported by Simon Pilgrim (llvm-dev@redking.me.uk)
Reported on 2018-08-13 08:15:59 -0700
Last modified on 2019-10-30 13:23:38 -0700
Version trunk
Hardware PC Windows NT
CC arnold.schwaighofer@gmail.com, aschwaighofer@apple.com, craig.topper@gmail.com, francisvm@yahoo.com, llvm-bugs@lists.llvm.org, stormbyte@gmail.com
Fixed by commit(s)
Attachments build.log.bz2 (59592 bytes, application/x-bzip)
file_38545.txt (259 bytes, text/plain)
Blocks
Blocked by
See also PR35767
define void @f() {
BB:
  br label %BB5

BB5:
  br i1 undef, label %BB5, label %BB1

BB1:
  %A31 = alloca swifterror i32
  %L7 = load i32, i32* %A31
  %B30 = add i32 %L7, 2147483647
  store i32 %B30, i32* %A31
  br label %BB1
}

llc -mtriple=x86_64-unknown

Cannot emit physreg copy instruction
UNREACHABLE executed at
/home/simon/LLVM/llvm/lib/Target/X86/X86InstrInfo.cpp:3112!

Reduced from https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4805
Quuxplusone commented 6 years ago
Running with -debug:

Machine Function
********** EXPANDING POST-RA PSEUDO INSTRS **********
********** Function: f
real copy:   renamable $rcx = COPY $rsp
replaced by: $rcx = MOV64rr $rsp
real copy:   $rsp = COPY killed renamable $rcx
replaced by: $rsp = MOV64rr killed $rcx
real copy:   renamable $eax = COPY killed renamable $rax
Cannot copy RAX to EAX
Cannot emit physreg copy instruction
UNREACHABLE executed at ../lib/Target/X86/X86InstrInfo.cpp:3112!
Quuxplusone commented 6 years ago

There looks to be an assumption in FunctionLoweringInfo::getOrCreateSwiftErrorVReg that the switch error store size should be equal to the pointer size.

Quuxplusone commented 6 years ago

Yes that is an unverified assumption.

The intended use of swifterror is to pass/return a pointer in a register.

Quuxplusone commented 6 years ago

_Bug 35767 has been marked as a duplicate of this bug._

Quuxplusone commented 4 years ago

Attached build.log.bz2 (59592 bytes, application/x-bzip): llvm build failure log (compressed)

Quuxplusone commented 4 years ago

Previous attachment is compilation of LLVM with CLang and LLD linker with polly optimizations enabled for 32bit (version 9).

The failure does not reproduce in a 64bit build.

Quuxplusone commented 4 years ago
(In reply to David C. Manuelda from comment #6)
> Previous attachment is compilation of LLVM with CLang and LLD linker with
> polly optimizations enabled for 32bit (version 9).
>
> The failure does not reproduce in a 64bit build.

(and -flto=thin enabled)
Quuxplusone commented 4 years ago
(In reply to David C. Manuelda from comment #6)
> Previous attachment is compilation of LLVM with CLang and LLD linker with
> polly optimizations enabled for 32bit (version 9).
>
> The failure does not reproduce in a 64bit build.

Did the compiler give you a preprocessed source file and script to submit?
Quuxplusone commented 4 years ago
(In reply to Craig Topper from comment #8)
> (In reply to David C. Manuelda from comment #6)
> > Previous attachment is compilation of LLVM with CLang and LLD linker with
> > polly optimizations enabled for 32bit (version 9).
> >
> > The failure does not reproduce in a 64bit build.
>
> Did the compiler give you a preprocessed source file and script to submit?

This is a gentoo build, I can provide config.log and the already provided
build.log, but since I have this into a compressed system image chrooted, I can
reproduce 100% of the times, so if you give me instruction I can do more
actions regard this failure.
Quuxplusone commented 4 years ago
(In reply to David C. Manuelda from comment #9)
> (In reply to Craig Topper from comment #8)
> > (In reply to David C. Manuelda from comment #6)
> > > Previous attachment is compilation of LLVM with CLang and LLD linker with
> > > polly optimizations enabled for 32bit (version 9).
> > >
> > > The failure does not reproduce in a 64bit build.
> >
> > Did the compiler give you a preprocessed source file and script to submit?
>
> This is a gentoo build, I can provide config.log and the already provided
> build.log, but since I have this into a compressed system image chrooted, I
> can reproduce 100% of the times, so if you give me instruction I can do more
> actions regard this failure.

Or even, share the image that you can chroot to it and try with emerge -1 llvm,
whatever you need just feel free to ask.
Quuxplusone commented 4 years ago

Normally when clang crashes it generates a shell script and a preprocessed source file and instructions about where to file a bug. Did that not happen in this case? That's what I need.

Quuxplusone commented 4 years ago
(In reply to Craig Topper from comment #11)
> Normally when clang crashes it generates a shell script and a preprocessed
> source file and instructions about where to file a bug. Did that not happen
> in this case? That's what I need.

Sorry, I just get this message:

LLVM ERROR: Cannot emit physreg copy instruction
clang-9: error: linker command failed with exit code 1 (use -v to see
invocation)

Tried with both, LLD and Gold linker producing the same failure with same
message
Quuxplusone commented 4 years ago

Oh. I guess LTO doesn't generate that report.

Quuxplusone commented 4 years ago
(In reply to Craig Topper from comment #13)
> Oh. I guess LTO doesn't generate that report.

Building with lto disabled now makes clang crash with a Segmentation Fault
signal, I don't know if that's related but I'm attaching the preprocessed
output as well as the stack trace, because it is weird that just disabling LTO
makes now this SIGSEGV.

If the issue is not related please tell me.
Quuxplusone commented 4 years ago

Attached file_38545.txt (259 bytes, text/plain): Bug preprocessed info