GHC Causes opt to crash under LLVM 3.1 due to non const memcpy offset
Under LLVM 3.1, opt is crashing when compiling code produced by GHC which makes calls to memcpy. After talking to the guys in #llvm they informed me that memcpy needs its alignment argument to be a const value, not from a value in a register. An example of the crash log:
alignment argument of memory intrinsics must be a constant int
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %lnfVC, i8* %lnfVE, i64 %lnfVF, i32 %lnfVG, i1 false)
alignment argument of memory intrinsics must be a constant int
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %lnfWc, i8* %lnfWe, i64 %lnfWf, i32 %lnfWg, i1 false)
alignment argument of memory intrinsics must be a constant int
call void @llvm.memmove.p0i8.p0i8.i64(i8* %lnfWk, i8* %lnfWm, i64 %lnfWn, i32 %lnfWo, i1 false)
alignment argument of memory intrinsics must be a constant int
call void @llvm.memmove.p0i8.p0i8.i64(i8* %lnfWJ, i8* %lnfWL, i64 %lnfWM, i32 %lnfWN, i1 false)
Broken module found, compilation aborted!
0 opt 0x000000010cec4be7 llvm::sys::ThreadLocal<llvm::PrettyStackTraceEntry const>::~ThreadLocal() + 6113
1 opt 0x000000010cec4eee llvm::sys::ThreadLocal<llvm::PrettyStackTraceEntry const>::~ThreadLocal() + 6888
2 libsystem_c.dylib 0x00007fff8dabacfa _sigtramp + 26
3 libsystem_c.dylib 000000000000000000 _sigtramp + 18446603338139325216
4 opt 0x000000010cec4dfc llvm::sys::ThreadLocal<llvm::PrettyStackTraceEntry const>::~ThreadLocal() + 6646
5 opt 0x000000010ce9865a llvm::StringMap<llvm::Value*, llvm::MallocAllocator>::clear() + 8942
6 opt 0x000000010ce975cd llvm::StringMap<llvm::Value*, llvm::MallocAllocator>::clear() + 4705
7 opt 0x000000010ce8b50b llvm::PassRegistrationListener::passEnumerate(llvm::PassInfo const*) + 12531
8 opt 0x000000010ce8b704 llvm::PassRegistrationListener::passEnumerate(llvm::PassInfo const*) + 13036
9 opt 0x000000010ce8b848 llvm::PassRegistrationListener::passEnumerate(llvm::PassInfo const*) + 13360
10 opt 0x000000010ce8bb28 llvm::PassRegistrationListener::passEnumerate(llvm::PassInfo const*) + 14096
11 opt 0x000000010ce8bf27 llvm::PassRegistrationListener::passEnumerate(llvm::PassInfo const*) + 15119
12 opt 0x000000010cc7a708 llvm::DenseMap<llvm::BasicBlock*, unsigned int, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::DenseMapInfo<unsigned int> >::init(unsigned int) + 4866
13 opt 0x000000010cc76364
Stack dump:
0. Program arguments: opt mmulttest.ll -o /var/folders/0n/bjp22m948xlgtl006s6kwyj00000gv/T/ghc87286_0/ghc87286_0.bc -O3 -std-compile-opts -time-passes -loop-unroll
1. Running pass 'Function Pass Manager' on module 'mmulttest.ll'.
2. Running pass 'Module Verifier' on function '@seo9_info'