Closed llvmbot closed 8 years ago
Thanks all for the test cases; sorry for the breakage. Resolving as fixed.
Another fix attempt: http://reviews.llvm.org/rL257133
After commit r257133 remaining benchmarks spec2006/444.namd, 447.dealII ran successfully. The issue is resolved.
Hey Sanjay, I've been hitting this as well and I think I was able to write a (pretty contrived) testcase:
define <4 x double> @t(i1 %c, i1 %c2, <2 x double> %a, <4 x double> %b) { bb1: br i1 %c, label %bb2, label %bb3
bb2: %r = call <2 x double> @dummy(<2 x double> %a) br label %bb3
bb3: %tmp1 = phi <2 x double> [ %a, %bb1 ], [ %r, %bb2 ] %tmp2 = phi <4 x double> [ %b, %bb1 ], [ zeroinitializer, %bb2 ] %tmp3 = extractelement <2 x double> %tmp1, i32 0 %tmp4 = insertelement <4 x double> %tmp2, double %tmp3, i32 2 ret <4 x double> %tmp4 }
declare <2 x double> @dummy(<2 x double>)
The shuffle gets inserted between the PHIs; breakage ensues.
Thank you, Ahmed, for making suitable reproducer.
Another fix attempt: http://reviews.llvm.org/rL257133
Patch posted for review: http://reviews.llvm.org/D15981
The shuffle gets inserted between the PHIs; breakage ensues.
Aha PHIs...thanks!
So I think we need to use "getFirstInsertionPt()" or some variant even when the extractelement's vector operand is defined by an instruction. It should be a tiny patch. I'll post it for review ASAP.
Hey Sanjay, I've been hitting this as well and I think I was able to write a (pretty contrived) testcase:
define <4 x double> @t(i1 %c, i1 %c2, <2 x double> %a, <4 x double> %b) { bb1: br i1 %c, label %bb2, label %bb3
bb2: %r = call <2 x double> @dummy(<2 x double> %a) br label %bb3
bb3: %tmp1 = phi <2 x double> [ %a, %bb1 ], [ %r, %bb2 ] %tmp2 = phi <4 x double> [ %b, %bb1 ], [ zeroinitializer, %bb2 ] %tmp3 = extractelement <2 x double> %tmp1, i32 0 %tmp4 = insertelement <4 x double> %tmp2, double %tmp3, i32 2 ret <4 x double> %tmp4 }
declare <2 x double> @dummy(<2 x double>)
The shuffle gets inserted between the PHIs; breakage ensues.
IR Dump Before Combine redundant instructions
...which is incomplete due to the crash.
Disregard that comment; the crash text appears to be after the IR is complete.
I think I still need the struct definitions though, unless there's some quick way to reverse engineer those from the IR. :)
There is fragment of spec2006/444.namd IR dump for ComputeNonbondedUtil.C module and one function ‘_ZN20ComputeNonbondedUtil20calc_pair_energy_fepEP9nonbonded'.
I don't know how to debug this without having the struct definitions that are used in the IR. Can you attach that too?
Also, it looks like the most relevant IR that we need to debug has been cut from the output.
There's:
IR Dump Before Simplify the CFG
which has no insertelement / extractelement instructions, so I don't think it can trigger the bug. And then it skips to:
IR Dump Before Combine redundant instructions
...which is incomplete due to the crash.
There is fragment of spec2006/444.namd IR dump for ComputeNonbondedUtil.C module and one function ‘_ZN20ComputeNonbondedUtil20calc_pair_energy_fepEP9nonbonded'.
I don't know how to debug this without having the struct definitions that are used in the IR. Can you attach that too?
I went ahead and checked in a fix that I hope will solve the SPEC errors too: http://reviews.llvm.org/rL256857
After commit r256857 three benchmarks (spec2000/188.ammp, spec2006/433.milc, 453.povray) ran successfully. And two benchmarks (spec2006/444.namd, 447.dealII) fail while one module compiling with the following stack, e.g, for 444.namd.
444.namd: ………….. clang++ -m64 -c -o ComputeNonbondedUtil.o -DSPEC_CPU -DNDEBUG -m64 -fuse-ld=gold -Ofast -funroll-loops -flto -static -mfpmath=sse -march=core-avx2 -DSPEC_CPU_LP64 ComputeNonbondedUtil.C clang-3.8: warning: argument unused during compilation: '-fuse-ld=gold'
Compilation fails on function ‘_ZN20ComputeNonbondedUtil20calc_pair_energy_fepEP9nonbonded’. IR dump fragments of this function before three compilation phases obtained with ‘-mllvm -print-before-all’ option is in attachment.
spec2006/444.namd IR dump for ComputeNonbondedUtil.C module
There is fragment of spec2006/444.namd IR dump for ComputeNonbondedUtil.C module and one function ‘_ZN20ComputeNonbondedUtil20calc_pair_energy_fepEP9nonbonded'.
I went ahead and checked in a fix that I hope will solve the SPEC errors too: http://reviews.llvm.org/rL256857
IR Dump After Module Verifier ; Function Attrs: nounwind uwtable
define internal i32 @u_f_nonbon(double %lambda) #0 { ……………………………………… } Instruction does not dominate all uses!
From the attachment, I'm not seeing what this function looked like before it was broken, so I can't make a test case from it. The attachment is also missing declares/defines for structs and attributes.
I have an idea what the problem is though, so I'll update the patch for bug 26015. Please let me know if that solves this bug too. Thanks!
Hi Sergey - I don't have access to SPEC. Can you attach an IR test case?
Hi, Sanjay, After commiting of fix for llvm/llvm-bugzilla-archive#26015 , I am verifying described benchmarks.
For spec2000/188.ammp on LTO phase compilation fails “After Module Verifier” of function ‘u_f_nonbon’ as follows. IR dump obtained with ‘-Wl,-plugin-opt=-print-after-all’ option is in attachment.
IR Dump After Module Verifier
; Function Attrs: nounwind uwtable
define internal i32 @u_f_nonbon(double %lambda) #0 {
………………………………………
}
Instruction does not dominate all uses!
%374 = extractelement <2 x double> %356, i32 0
%369 = fmul fast double %368, %374
LLVM ERROR: Broken function found, compilation aborted!
clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)
spec2000/188.ammp IR dump on LTO phase spec2000/188.ammp IR dump is obtained with ‘-Wl,-plugin-opt=-print-after-all’ option on LTO phase.
Hi Sergey - I don't have access to SPEC. Can you attach an IR test case?
Extended Description
Bisect analysis showed LLVM revision 256394 is responsible for the fails. The comments to commit are the following.
commit 75759ab3e9255fe5f716e4a71ca1ee56901dedf8 Author: Sanjay Patel spatel@rotateright.com Date: Thu Dec 24 21:17:56 2015 +0000
LLVM-clang options: -m64 -fuse-ld=gold -Ofast -funroll-loops -flto -static -mfpmath=sse -march=core-avx2
During LTO phase spec benchmarks fail with the following error message (e.g., spec2006/444.namd).
runspec --config=lnx-x86_64-clang-default.cfg --rebuild -a build -e ref64 -T base 444 …………………………………………
clang++ -m64 -m64 -fuse-ld=gold -Ofast -funroll-loops -flto -static -mfpmath=sse -march=core-avx2 -DSPEC_CPU_LP64 Compute.o ComputeList.o ComputeNonbondedUtil.o LJTable.o Molecule.o Patch.o PatchList.o ResultSet.o SimParameters.o erf.o spec_namd.o -o namd Instruction does not dominate all uses! %782 = extractelement <2 x double> %721, i32 1 %779 = insertelement <4 x double> undef, double %782, i32 0 Instruction does not dominate all uses! %1053 = extractelement <2 x double> %974, i32 1 %1050 = insertelement <4 x double> undef, double %1053, i32 0 Instruction does not dominate all uses! %1332 = shufflevector <2 x double> %1263, <2 x double> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef> %1330 = shufflevector <4 x double> %1329, <4 x double> %1332, <4 x i32> <i32 0, i32 5, i32 undef, i32 undef> LLVM ERROR: Broken function found, compilation aborted! clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation) specmake: *** [namd] Error 1
Okunev Sergey, Software Engineer Intel Compiler Team