The current clang trunk crashes when compiling the following testcase at -O2 and -O3 in 32-bit mode (but not 64-bit mode) on x86_64-linux-gnu. This is a regression from clang 3.3. The "main" could certainly be removed, but beyond that, this is the simplest I could get so far. $ clang-trunk -v clang version 3.5 (trunk 195569) Target: x86_64-unknown-linux-gnu Thread model: posix Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.6 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6 $ $ clang-trunk -m32 -Os small.c; a.out $ clang-trunk -m64 -O2 small.c; a.out $ clang-3.3 -m32 -O2 small.c; a.out $ $ clang-trunk -m32 -O2 small.c fatal error: error in backend: Cannot select: 0x4200920: v4i32,ch = load 0x41d6ab0, 0x4205850, 0x41dcb10<LD16[getelementptr inbounds ([4 x i32]* @e, i32 0, i32 0)](align=4)> [ORD=82] [ID=58] 0x4205850: i32 = X86ISD::Wrapper 0x41d5490 [ORD=26] [ID=43] 0x41d5490: i32 = TargetGlobalAddress<[4 x i32]* @e> 0 [ORD=26] [ID=23] 0x41dcb10: i32 = undef [ID=2] In function: fn3 clang: error: clang frontend command failed with exit code 70 (use -v to see invocation) clang version 3.5 (trunk 195569) Target: i386-unknown-linux-gnu Thread model: posix clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /tmp/small-85844e.c clang: note: diagnostic msg: /tmp/small-85844e.sh clang: note: diagnostic msg: ******************** $ ----------------------------------------- int a, b, c, d, e[4], f[4], g, h, i, j, l; short k; char fn1 (int p) { return p + a; } int fn2 (int p1, int p2) { return 1 ^ -p2 ^ p2 ? 0 : p1 - 1; } void fn3 () { for (l = 0; l < 1; l++) if (i) for (h = 0; h < 4; h++) { k = c * d; j = k * b; f[h] = fn2 (e[h], ((f[h] >= 0) <= (g >= fn1 (e[3] < (d = (j ^ 1) < 1)))) & e[h]); } } int main () { fn3 (); return 0; }
Hi, I found next peace of code in X86ISelLowering.cpp, line 16301: [code] // Combine a vector_shuffle that is equal to build_vector load1, load2, load3, // load4, <0, 1, 2, 3> into a 128-bit load if the load addresses are // consecutive, non-overlapping, and in the right order. SmallVector<SDValue, 16> Elts; for (unsigned i = 0, e = VT.getVectorNumElements(); i != e; ++i) Elts.push_back(getShuffleScalarElt(N, i, DAG, 0)); return EltsFromConsecutiveLoads(VT, Elts, dl, DAG); [/code] These lines performed after legalization stage. But I'm not sure its legal for -m32.
Created attachment 11729 [details] Short test-case for llc Short test-case. Run command: 'llc -mcpu=x86-64 -mattr=ssse'
Fix: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20131209/198618.html
Fixed in r197492.