#6158: GHC Causes opt to crash under LLVM 3.1 due to non const memcpy offset
--------------------------------+-------------------------------------------
    Reporter:  Axman6           |       Owner:  dterei            
        Type:  bug              |      Status:  new               
    Priority:  normal           |   Milestone:                    
   Component:  Compiler (LLVM)  |     Version:  7.4.1             
    Keywords:  llvm memcpy      |          Os:  MacOS X           
Architecture:  x86_64 (amd64)   |     Failure:  Compile-time crash
  Difficulty:  Unknown          |    Testcase:                    
   Blockedby:                   |    Blocking:                    
     Related:                   |  
--------------------------------+-------------------------------------------
Changes (by simonmar):

  * difficulty:  => Unknown


Old description:

> 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'

New description:

 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'
 }}}

--

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6158#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to