llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.03k stars 11.97k forks source link

"llvm-gcc -m64" assert in CodeGen/LiveInterval.cpp:224 #1771

Closed llvmbot closed 14 years ago

llvmbot commented 17 years ago
Bugzilla Link 1399
Resolution FIXED
Resolved on Mar 06, 2010 13:58
Version trunk
OS MacOS X
Reporter LLVM Bugzilla Contributor

Extended Description

Compiling the following program, "llvm-gcc -m64 main.c":

include

int main(void) { printf("hello world.\n"); return 0; }

generates the following output:

$ llvm-gcc -m64 -v main.c Using built-in specs. Target: powerpc-apple-darwin8.9.0 Configured with: ../../configure --prefix=/Users/scottm/play/llvm-cfrontend/obj/powerpc-apple-darwin8.8.0/../../powerpc-apple-darwin8.8.0 --enable-llvm=/Users/scottm/play/llvm-cfrontend/obj/powerpc-apple-darwin8.8.0/../../../llvm/trunk/obj/powerpc-apple-darwin8.8.0 --disable-intl --disable-nls --enable-languages=c,c++ : (reconfigured) ../../configure --prefix=/Users/scottm/play/llvm-cfrontend/obj/powerpc-apple-darwin8.8.0/../../powerpc-apple-darwin8.8.0 --enable-llvm=/Users/scottm/play/llvm-cfrontend/obj/powerpc-apple-darwin8.8.0/../../../llvm/trunk/obj/powerpc-apple-darwin8.8.0 --disable-intl --disable-nls --with-gcc-version-trigger=/Users/scottm/play/llvm-cfrontend/gcc/version.c --enable-languages=c,c++ --no-create --no-recursion Thread model: posix gcc version 4.0.1 LLVM (Apple Computer, Inc. build 5449) /Users/scottm/play/llvm-cfrontend/powerpc-apple-darwin8.8.0/bin/../libexec/gcc/powerpc-apple-darwin8.9.0/4.0.1/cc1 -quiet -v -iprefix /Users/scottm/play/llvm-cfrontend/powerpc-apple-darwin8.8.0/bin/../lib/gcc/powerpc-apple-darwin8.9.0/4.0.1/ -DDYNAMIC main.c -fPIC -quiet -dumpbase main.c -mmacosx-version-min=10.4 -m64 -auxbase main -version -o /var/tmp//ccXnbSOF.s ignoring nonexistent directory "/Users/scottm/play/llvm-cfrontend/powerpc-apple-darwin8.8.0/bin/../lib/gcc/powerpc-apple-darwin8.9.0/4.0.1/../../../../powerpc-apple-darwin8.9.0/include" ignoring nonexistent directory "/usr/local/include" ignoring duplicate directory "/Users/scottm/play/llvm-cfrontend/obj/powerpc-apple-darwin8.8.0/../../powerpc-apple-darwin8.8.0/lib/gcc/powerpc-apple-darwin8.9.0/4.0.1/include" ignoring nonexistent directory "/Users/scottm/play/llvm-cfrontend/obj/powerpc-apple-darwin8.8.0/../../powerpc-apple-darwin8.8.0/lib/gcc/powerpc-apple-darwin8.9.0/4.0.1/../../../../powerpc-apple-darwin8.9.0/include"

include "..." search starts here:

include <...> search starts here:

/Users/scottm/play/llvm-cfrontend/powerpc-apple-darwin8.8.0/bin/../lib/gcc/powerpc-apple-darwin8.9.0/4.0.1/include /Users/scottm/play/llvm-cfrontend/obj/powerpc-apple-darwin8.8.0/../../powerpc-apple-darwin8.8.0/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. GNU C version 4.0.1 LLVM (Apple Computer, Inc. build 5449) (powerpc-apple-darwin8.9.0) compiled by GNU C version 4.0.1 (Apple Computer, Inc. build 5367). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 3fb6b8555bd4abe30e257ef177238c8e /Users/scottm/play/llvm/trunk/lib/CodeGen/LiveInterval.cpp:224: failed assertion `I != ranges.begin() && "Range is not in interval!"' main.c:4: internal compiler error: Abort trap Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://llvm.org/bugs> for instructions.

llvmbot commented 17 years ago

Test here: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070507/049460.html

lattner commented 17 years ago

An obvious fix is to mark R3 a sub-register of X3, but it's not entirely clear to me if that's semantically correct.

Yep, that's right. R3 is the low 32-bits of X3.

Come to think of it. Aliases is defined as "registers that this register overlaps with". That seems like a mismaatch. It's probably better to rename it "Overlaps" (or something better?)

Sure.

Should this bug be closed, now that your patch has been applied? Please check in a testcase also.

Thanks for taking care of this so quickly Evan!

-Chris

llvmbot commented 17 years ago

The problem is R3 is marked an alias of X3. But livevariables no longer process aliases, it only deals with sub- and super-registers.

An obvious fix is to mark R3 a sub-register of X3, but it's not entirely clear to me if that's semantically correct.

Come to think of it. Aliases is defined as "registers that this register overlaps with". That seems like a mismaatch. It's probably better to rename it "Overlaps" (or something better?)

llvmbot commented 17 years ago

Something is wrong upstream. BL8_Macho def / use PPC::X3 (printed as r3), but the move instruction (i.e. OR %r3, %r3) is refering to PPC::R3.

llvmbot commented 17 years ago

Something is wrong with LiveVariables:

12 %r3 = OR8 %reg1025, %reg1025 OR8 %mreg(165) %reg1025 %reg1025 register: r3 killed +[14,18:0) 16 BL8_Macho , %r3, %r0<imp-def,dead>, %r2<imp-def,dead>, %r3<imp-def,dead>, %r4<imp-def,dead>, %r5<imp-def,dead>, %r6<imp-def,dead>, %r7<imp-def,dead>, %r8<i\mp-def,dead>, %r9<imp-def,dead>, %r10<imp-def,dead>, %r11<imp-def,dead>, %r12<imp-def,dead>, %f0<imp-def,dead>, %f1<imp-def,dead>, %f2<imp-def,dead>, %f3<imp-def,dead>, %f4<imp-d\ef,dead>, %f5<imp-def,dead>, %f6<imp-def,dead>, %f7<imp-def,dead>, %f8<imp-def,dead>, %f9<imp-def,dead>, %f10<imp-def,dead>, %f11<imp-def,dead>, %f12<imp-def,dead>, %f13<imp-def,\dead>, %v0<imp-def,dead>, %v1<imp-def,dead>, %v2<imp-def,dead>, %v3<imp-def,dead>, %v4<imp-def,dead>, %v5<imp-def,dead>, %v6<imp-def,dead>, %v7<imp-def,dead>, %v8<imp-def,dead>, \%v9<imp-def,dead>, %v10<imp-def,dead>, %v11<imp-def,dead>, %v12<imp-def,dead>, %v13<imp-def,dead>, %v14<imp-def,dead>, %v15<imp-def,dead>, %v16<imp-def,dead>, %v17<imp-def,dead>,\ %v18<imp-def,dead>, %v19<imp-def,dead>, %lr<imp-def,dead>, %ctr<imp-def,dead>, %cr0, %cr1<imp-def,dead>, %cr5<imp-def,dead>, %cr6<imp-def,dead>, %cr7<imp-def,dead> 20 %reg1026 = OR %r3, %r3

BL8_Macho implicit def of r3 is marked dead. But it does have a use.

lattner commented 17 years ago

Evan, can you please look into this? This makes it sound like ppc64 is completely broken (unable to build hello world?). If the fix is straight-forward, we should consider merging it into the llvm 2.0 branch.

-Chris