Bug 236567

Summary: lang/spidermonkey170, lang/spidermonkey38: clang 8 crashes during build on armv7 and armv6
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: freebsd-toolchain (Nobody) <toolchain>
Status: Closed FIXED    
Severity: Affects Only Me CC: dim, gecko, kwm
Priority: --- Keywords: needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (kwm)
Hardware: arm   
OS: Any   
Bug Depends on:    
Bug Blocks: 236062    
Attachments:
Description Flags
vm/Interpreter.cpp (compressed, preprocessed)
none
command line args (for clang 8) none

Description Jan Beich freebsd_committer freebsd_triage 2019-03-16 04:17:52 UTC
$ poudriere jail -cj head-armv7 -x -a arm.armv7 -v head -m svn+https
$ poudriere testport -j head-armv7 lang/spidermonkey38
[...]
Unable to predicate BX killed renamable $r0
!
UNREACHABLE executed at /usr/src/contrib/llvm/lib/CodeGen/IfConversion.cpp:2022!
c++: error: unable to execute command: Abort trap (core dumped)
c++: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 8.0.0 (branches/release_80 355677) (based on LLVM 8.0.0)
Target: armv7-unknown-freebsd13.0-gnueabihf
Thread model: posix
InstalledDir: /usr/bin

http://www.ipv6proxy.net/go.php?u=http://beefy16.nyi.freebsd.org/data/head-armv7-default/p495093_s344952/logs/errors/spidermonkey170-17.0.0_8.log
http://www.ipv6proxy.net/go.php?u=http://beefy16.nyi.freebsd.org/data/head-armv7-default/p495093_s344952/logs/errors/spidermonkey38-38.8.0_9.log
http://beefy8.nyi.freebsd.org/data/head-armv6-default/p495404_s345044/logs/errors/spidermonkey38-38.8.0_9.log
http://beefy8.nyi.freebsd.org/data/head-armv6-default/p495404_s345044/logs/errors/spidermonkey170-17.0.0_8.log

Also affects some other ports (found only where qemu-user-static didn't hang):

http://www.ipv6proxy.net/go.php?u=http://beefy16.nyi.freebsd.org/data/head-armv7-default/p495093_s344952/logs/errors/palemoon-27.9.4_4.log
http://www.ipv6proxy.net/go.php?u=http://beefy16.nyi.freebsd.org/data/head-armv7-default/p495093_s344952/logs/errors/seamonkey-2.49.4_24.log
http://beefy8.nyi.freebsd.org/data/head-armv6-default/p495404_s345044/logs/errors/erlang-riak-16.b.02.log
Comment 1 Jan Beich freebsd_committer freebsd_triage 2019-03-16 04:19:53 UTC
Created attachment 202899 [details]
vm/Interpreter.cpp (compressed, preprocessed)
Comment 2 Jan Beich freebsd_committer freebsd_triage 2019-03-16 04:20:18 UTC
Created attachment 202900 [details]
command line args (for clang 8)
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2019-03-18 09:59:07 UTC
Reproduced, minimized and submitted upstream here:

https://bugs.llvm.org/show_bug.cgi?id=41121
Comment 4 commit-hook freebsd_committer freebsd_triage 2019-09-06 16:07:29 UTC
A commit references this bug:

Author: dim
Date: Fri Sep  6 16:06:38 UTC 2019
New revision: 351938
URL: https://svnweb.freebsd.org/changeset/base/351938

Log:
  Pull in r371111 from upstream llvm trunk (by Eli Friedman):

    [IfConversion] Fix diamond conversion with unanalyzable branches.

    The code was incorrectly counting the number of identical
    instructions, and therefore tried to predicate an instruction which
    should not have been predicated.  This could have various effects: a
    compiler crash, an assembler failure, a miscompile, or just
    generating an extra, unnecessary instruction.

    Instead of depending on TargetInstrInfo::removeBranch, which only
    works on analyzable branches, just remove all branch instructions.

    Fixes https://bugs.llvm.org/show_bug.cgi?id=43121 and
    https://bugs.llvm.org/show_bug.cgi?id=41121 .

    Differential Revision: https://reviews.llvm.org/D67203

  This should fix "Unable to predicate BX killed renamable $r0" errors
  when building the lang/spidermonkey170 and lang/spidermonkey38 ports for
  armv7 and armv6.

  PR:		236567
  MFC after:	3 days

Changes:
  head/contrib/llvm/lib/CodeGen/IfConversion.cpp
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-09-09 17:59:01 UTC
A commit references this bug:

Author: dim
Date: Mon Sep  9 17:58:27 UTC 2019
New revision: 352089
URL: https://svnweb.freebsd.org/changeset/base/352089

Log:
  MFC r351938:

  Pull in r371111 from upstream llvm trunk (by Eli Friedman):

    [IfConversion] Fix diamond conversion with unanalyzable branches.

    The code was incorrectly counting the number of identical
    instructions, and therefore tried to predicate an instruction which
    should not have been predicated.  This could have various effects: a
    compiler crash, an assembler failure, a miscompile, or just
    generating an extra, unnecessary instruction.

    Instead of depending on TargetInstrInfo::removeBranch, which only
    works on analyzable branches, just remove all branch instructions.

    Fixes https://bugs.llvm.org/show_bug.cgi?id=43121 and
    https://bugs.llvm.org/show_bug.cgi?id=41121 .

    Differential Revision: https://reviews.llvm.org/D67203

  This should fix "Unable to predicate BX killed renamable $r0" errors
  when building the lang/spidermonkey170 and lang/spidermonkey38 ports for
  armv7 and armv6.

  PR:		236567

Changes:
_U  stable/11/
  stable/11/contrib/llvm/lib/CodeGen/IfConversion.cpp
_U  stable/12/
  stable/12/contrib/llvm/lib/CodeGen/IfConversion.cpp