Strange i386 cross build error.

As part of my ELLCC project (http://ellcc.org), I build clang/LLVM on my native x86_64 Linux box and then use it to compile itself. For further sanity checking, I then use that copy to cross compile for other targets (arm, armeb, i386, microblaze, mips, mipsel, ppc, and x86_64). After updating to a recent TOT revision, r195452, I get a strange error when cross compiling for the i386:

llvm[2]: Compiling MCObjectSymbolizer.cpp for Release+Asserts build
PHI node has multiple entries for the same basic block with different incoming values!
   %Value.addr.1.off0 = phi i32 [ %7, %entry ], [ %8, %entry ], [ %9, %entry ], [ %extract.t521, %sw.bb9 ]
   label %entry
     %7 = extractelement <2 x i32> %3, i32 0
       %9 = extractelement <2 x i32> %3, i32 0
       PHI node has multiple entries for the same basic block with different incoming values!
         %retval.0 = phi i32 [ %conv366, %if.then357 ], [ %conv368, %if.end367 ], [ %conv333, %if.end323 ], [ %conv309, %sw.bb305 ], [ %conv304, %sw.bb300 ], [ %or299, %sw.bb290 ], [ %conv289, %sw.bb285 ], [ %or284, %sw.bb239 ], [ %or238, %sw.bb203 ], [ %conv202, %sw.bb176 ], [ %or174517, %sw.bb120 ], [ %conv119, %sw.bb115 ], [ %or113518, %sw.bb84 ], [ %or83, %_ZN4llvm6ARM_AML11getSOImmValEj.exit ], [ %conv64, %sw.bb60 ], [ %conv57, %if.then50 ], [ %conv59, %if.end58 ], [ %or35, %sw.bb11 ], [ %or, %sw.bb2 ], [ %4, %entry ], [ %5, %entry ], [ %6, %entry ]
         label %entry
           %5 = extractelement <2 x i32> %3, i32 0
             %6 = extractelement <2 x i32> %3, i32 0
             Broken module found, compilation aborted!
             Stack dump:
             0. Program arguments: /home/rich/test/bin/ecc -cc1 -triple i386-ellcc-linux -emit-obj -disable-free -main-file-name ARMAsmBackend.cpp -mrelocation-model static -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -target-linker-version 2.22.52.0.1 -momit-leaf-frame-pointer -coverage-file /home/rich/test/llvm-build-i386-linux/lib/Target/ARM/MCTargetDesc/Release+Asserts/ARMAsmBackend.o -resource-dir /home/rich/test/bin/../libecc -dependency-file /home/rich/test/llvm-build-i386-linux/lib/Target/ARM/MCTargetDesc/Release+Asserts/ARMAsmBackend.d.tmp -MP -MT /home/rich/test/llvm-build-i386-linux/lib/Target/ARM/MCTargetDesc/Release+Asserts/ARMAsmBackend.o -MT /home/rich/test/llvm-build-i386-linux/lib/Target/ARM/MCTargetDesc/Release+Asserts/ARMAsmBackend.d -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D ELLCC_ARG0="i386-ellcc-linux" -I /home/rich/test/llvm-build-i386-linux/lib/Target/ARM/MCTargetDesc/.. -I /home/rich/test/llvm/lib/Target/ARM/MCTargetDesc/.. -I /home/rich/test/llvm-build-i386-linux/include -I /home/rich/test/llvm-build-i386-linux/lib/Target/ARM/MCTargetDesc -I /home/rich/test/llvm/include -I /home/rich/test/llvm/lib/Target/ARM/MCTargetDesc -O3 -Woverloaded-virtual -Wcast-qual -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcovered-switch-default -Wno-uninitialized -Wno-missing-field-initializers -pedantic -fdeprecated-macro -fdebug-compilation-dir /home/rich/test/llvm-build-i386-linux/lib/Target/ARM/MCTargetDesc -ferror-limit 19 -fmessage-length 130 -mstackrealign -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /home/rich/test/llvm-build-i386-linux/lib/Target/ARM/MCTargetDesc/Release+Asserts/ARMAsmBackend.o -x c++ /home/rich/test/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
             1. <eof> parser at end of file
             2. Code generation
             3. Running pass 'Function Pass Manager' on module '/home/rich/test/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp'.
             4. Running pass 'Module Verifier' on function '@_ZL16adjustFixupValueRKN4llvm7MCFixupEyPNS_9MCContextE'
             ecc: error: unable to execute command: Killed
             ecc: error: clang frontend command failed due to signal (use -v to see invocation)
             clang version 3.5 (trunk)
             Target: i386-ellcc-linux
             Thread model: posix
             ecc: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
             llvm[3]: Compiling MipsJITInfo.cpp for Release+Asserts build
             ecc: note: diagnostic msg:

            ecc: note: diagnostic msg: /tmp/ARMAsmBackend-265222.cpp
            ecc: note: diagnostic msg: /tmp/ARMAsmBackend-265222.sh
            ecc: note: diagnostic msg:

            ********************
The error only occurs for i386. Any ideas?

Open a bug report with ARMAsmBackend-265222.cpp and ARMAsmBackend-265222.sh?

Cheers,
Rafael

I saw this; http://bb.pgr.jp/builders/clang-3stage-cygwin

Not sure, though, r195406 triggered this issue. I am still investigating.
I guess it could be reproducible with -target i686-* on other hosts.

That is exactly the error I'm seeing. I also saw it bootstrapping on an i386 Linux system. I filed bug 18060.

-Rich