Register allocator chokes on certain branches with literals
While running the test for #7571 (closed) (test is in #7573 (closed),) under WAY=normal instead of WAY=llvm, I encountered this bug in the native backend:
=====> T7571(normal) 6 of 6 [0, 0, 0]
cd . && '/Users/a/code/haskell/ghc/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts -fno-ghci-history -c T7571.cmm -no-hs-main >T7571.comp.stderr 2>&1
Compile failed (status 256) errors were:
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 7.7.20130113 for x86_64-apple-darwin):
allocateRegsAndSpill: Cannot read from uninitialized register
%vI_c7
The test in question is:
#include "Cmm.h"
testLiteralBranch (W_ dst, W_ src)
{
if (1) {
prim %memcpy(dst, src, 1024, 4);
} else {
prim %memcpy(dst, src, 512, 8);
}
return ();
}
If you comment out the branch conditionals, the test passes, so clearly something fishy is going on here. The test also fails if you change the condition to if (1 == 1)
I have absolutely no idea how this did not trip the profiling-based build in StgStdThunks.cmm, like in the LLVM build c.f. #7571 (closed)