[AVX-512] llc crash with UNREACHABLE executed at lib/IR/ValueTypes.cpp:128
| Bugzilla Link | 28119 |
| Resolution | FIXED |
| Resolved on | Jun 27, 2016 14:56 |
| Version | trunk |
| OS | Linux |
| Attachments | Reproducer. |
| CC | @dbabokin,@delena,@igor-breger,@Vsevolod-Livinskij |
Extended Description
llc crashes with -mcpu=knl.
Test:
cat repr.cpp bool a, b, d, e; struct struct_1 { int member_1_3 : 24; } c; void fn1() { if (a) ; else { b = c.member_1_3 << bool(c.member_1_3) + e; d = c.member_1_3 << a - 4294967293; } }
clang++ -S -emit-llvm repr.cpp -march=knl cat repr.ll ; ModuleID = 'repr.cpp' source_filename = "repr.cpp" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu"
%struct.struct_1 = type { i24 }
@a = global i8 0, align 1 @b = global i8 0, align 1 @d = global i8 0, align 1 @e = global i8 0, align 1 @c = global %struct.struct_1 zeroinitializer, align 4
; Function Attrs: nounwind uwtable define void @_Z3fn1v() #0 { entry: %0 = load i8, i8* @a, align 1 %tobool = trunc i8 %0 to i1 br i1 %tobool, label %if.then, label %if.else
if.then: ; preds = %entry br label %if.end
if.else: ; preds = %entry %bf.load = load i32, i32* bitcast (%struct.struct_1* @c to i32*), align 4 %bf.shl = shl i32 %bf.load, 8 %bf.ashr = ashr i32 %bf.shl, 8 %bf.load1 = load i32, i32* bitcast (%struct.struct_1* @c to i32*), align 4 %bf.shl2 = shl i32 %bf.load1, 8 %bf.ashr3 = ashr i32 %bf.shl2, 8 %tobool4 = icmp ne i32 %bf.ashr3, 0 %conv = zext i1 %tobool4 to i32 %1 = load i8, i8* @e, align 1 %tobool5 = trunc i8 %1 to i1 %conv6 = zext i1 %tobool5 to i32 %add = add nsw i32 %conv, %conv6 %shl = shl i32 %bf.ashr, %add %tobool7 = icmp ne i32 %shl, 0 %frombool = zext i1 %tobool7 to i8 store i8 %frombool, i8* @b, align 1 %bf.load8 = load i32, i32* bitcast (%struct.struct_1* @c to i32*), align 4 %bf.shl9 = shl i32 %bf.load8, 8 %bf.ashr10 = ashr i32 %bf.shl9, 8 %2 = load i8, i8* @a, align 1 %tobool11 = trunc i8 %2 to i1 %conv12 = zext i1 %tobool11 to i64 %sub = sub nsw i64 %conv12, 4294967293 %sh_prom = trunc i64 %sub to i32 %shl13 = shl i32 %bf.ashr10, %sh_prom %tobool14 = icmp ne i32 %shl13, 0 %frombool15 = zext i1 %tobool14 to i8 store i8 %frombool15, i8* @d, align 1 br label %if.end
if.end: ; preds = %if.else, %if.then ret void }
attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="knl" "target-features"="+adx,+aes,+avx,+avx2,+avx512cd,+avx512er,+avx512f,+avx512pf,+bmi,+bmi2,+cx16,+f16c,+fma,+fsgsbase,+fxsr,+lzcnt,+mmx,+movbe,+pclmul,+popcnt,+prefetchwt1,+rdrnd,+rdseed,+rtm,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.ident = !{#0}
!0 = !{!"clang version 3.9.0 (trunk 272396)"}
llc -mcpu=knl func.ll Overran sorted position: t7232: Invalid EVT! UNREACHABLE executed at /export/users/vlivinsk/llvm/llvm-trunk/lib/IR/ValueTypes.cpp:128! #0 0x0000000001003b45 (llc+0x1003b45) #1 0x00000000010017e6 (llc+0x10017e6) #2 0x0000000001001a02 (llc+0x1001a02) #3 0x00007fa966d17430 __restore_rt (/lib64/libpthread.so.0+0x10430) #4 0x00007fa965ec49c8 __GI_raise (/lib64/libc.so.6+0x349c8) #5 0x00007fa965ec665a __GI_abort (/lib64/libc.so.6+0x3665a) #6 0x0000000000fbbdc0 (llc+0xfbbdc0) #7 0x0000000000c860b7 (llc+0xc860b7) #8 0x0000000000ecb9bc (llc+0xecb9bc) #9 0x0000000000ecede0 (llc+0xecede0) #10 0x0000000000ecf62e (llc+0xecf62e) #11 0x0000000000ecfd53 (llc+0xecfd53) #12 0x0000000000ea35a6 (llc+0xea35a6) #13 0x0000000000ed23ac (llc+0xed23ac) #14 0x0000000000ed663b (llc+0xed663b) #15 0x0000000000edfb55 (llc+0xedfb55) #16 0x0000000000ee1ff0 (llc+0xee1ff0) #17 0x0000000000652c44 (llc+0x652c44) #18 0x00000000009d46c5 (llc+0x9d46c5) #19 0x0000000000c47ee3 (llc+0xc47ee3) #20 0x0000000000c482bb (llc+0xc482bb) #21 0x0000000000c47a2a (llc+0xc47a2a) #22 0x000000000057fd6f (llc+0x57fd6f) #23 0x00000000005567a0 (llc+0x5567a0) #24 0x00007fa965eb0700 __libc_start_main (/lib64/libc.so.6+0x20700) #25 0x0000000000575d79 (llc+0x575d79) Stack dump:
-
Program arguments: llc -mcpu=knl func.ll -
Running pass 'Function Pass Manager' on module 'func.ll'. -
Running pass 'X86 DAG->DAG Instruction Selection' on function '@_Z3fn1v'
Aborted (core dumped)
LLVM version:
clang++ -v clang version 3.9.0 (trunk 272396) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /export/users/vlivinsk/llvm/bin-trunk/bin Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/5.1.1 Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/5.1.1 Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/5.1.1 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64
Fixed in 273899
This test case fails on other architectures too. I'll look at the bug, but it is not KNL specific.