LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 20098 - Backend crashes on mode(TI) add/sub for mips64
Summary: Backend crashes on mode(TI) add/sub for mips64
Status: RESOLVED FIXED
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-21 22:47 PDT by Duane Sand
Modified: 2016-07-18 08:19 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duane Sand 2014-06-21 22:47:13 PDT
Android's 3.4 and 3.5 clang crashes in backend when compiling Android's latest copy of compiler-rt to a mips64 target.  The crashes happens on every recently-added CRT_HAS_128BIT compiler_rt/lib/builtins/* routine that uses the mode(TI) 128-bit integer datatype.

compile command for reduced example:
prebuilts/clang/linux-x86/host/3.5/bin/clang -target mips64el-linux-android clangbug.c


Source code for reduced test case clangbug.c:

typedef int ti_int __attribute__ ((mode (TI)));
ti_int  bug(ti_int a, ti_int b)
{
    return a + b;
}


This gives the compile-time failure message:

fatal error: error in backend: Cannot select: 0xf8852f88: i64,glue = addc 0xf8852dd8, 0xf8850d00 [ORD=8] [ID=34]
  0xf8852dd8: i64,ch = load 0xf8852d48, 0xf8851690, 0xf8851720<LD8[%1](align=16)> [ORD=6] [ID=32]
    0xf8851690: i64 = FrameIndex<0> [ID=9]
    0xf8851720: i64 = undef [ID=10]
  0xf8850d00: i64,ch = CopyFromReg 0xf8843490, 0xf8850c70 [ORD=1] [ID=17]
    0xf8850c70: i64 = Register %vreg2 [ID=3]
In function: bug
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 3.5
Target: mips64el--linux-android


This problem is preventing all builds of the mips64 version of Android at AOSP.  As a workaround until the mips64 codegen is made solid for this datatype and that compiler is available at aosp, we are removing these unneeded CRT_HAS_128BIT library routines via the compiler_rt patch
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140616/222726.html
Comment 1 Stephen Hines 2015-07-02 17:20:49 PDT
This recently broke Android compilation for MIPS64, so I would like to see a better resolution here. Right now, I have to define this in order to even build a sufficient compiler-rt. Are there any updates here?
Comment 2 Stephen Hines 2015-07-02 17:30:07 PDT
Can someone try reverting r224488 in compiler-rt and check that MIPS64 is fine? I can build for MIPS64, which was apparently the original issue (crashes in instruction selection). I don't have a great way to test this compiler-rt, however, since I have no way to execute the testcases for these functions.
Comment 3 Duane Sand 2015-07-06 18:49:16 PDT
With current compilers at Aosp master branch, mips64 Android builds and boots successfully on the Android emulator, with compiler-rt patch 
   https://android-review.googlesource.com/#/c/124723/1
reverted.
Comment 4 Daniel Sanders 2016-07-18 08:19:41 PDT
This seems to have been resolved but the ticket wasn't marked as such. Feel free to re-open if this ticket should be open.