llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.08k stars 11.99k forks source link

ARM codegen ice - expected larger existing stack allocation #15665

Closed llvmbot closed 11 years ago

llvmbot commented 11 years ago
Bugzilla Link 15293
Resolution FIXED
Resolved on May 06, 2013 12:46
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @redstar,@kaomoneus

Extended Description

Can be reproduced using llc on the following:

; ModuleID = 'bugpoint-reduced-simplified.bc' target datalayout = "e-p:32:32:32-S64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:64:128-a0:0:64-n32" target triple = "arm--linux-gnueabihf"

%"armbug.Rebindable!(TimeZone).Rebindable" = type <{ i8 }> %armbug.SysTime = type <{ %"armbug.Rebindable!(TimeZone).Rebindable" }> %armbug.TimeZone = type { i8* }

declare fastcc void @​opAssign(%"armbug.Rebindable!(TimeZone).Rebindable", %"armbug.Rebindable!(TimeZone).Rebindable" byval)

define fastcc %armbug.SysTime @​doOpAssign(%armbug.SysTime %.this_arg, %armbug.SysTime* byval %p_arg) { entry: br i1 undef, label %noassert, label %assert

assert: ; preds = %entry unreachable

noassert: ; preds = %entry call fastcc void @​opAssign(%"armbug.Rebindable!(TimeZone).Rebindable" undef, %"armbug.Rebindable!(TimeZone).Rebindable" byval undef) ret %armbug.SysTime* %.this_arg }

and results in:

Assertion failed: (size >= excess && "expected larger existing stack allocation"), function HandleByVal, file ARMISelLowering.cpp, line 1681. 0 llc 0x0000000109bb42bd char const std::__find<char const, char>(char const, char const, char const&, std::random_access_iterator_tag) + 1233 1 llc 0x0000000109bb4650 char const std::__find<char const, char>(char const, char const, char const&, std::random_access_iterator_tag) + 2148 2 libsystem_c.dylib 0x00007fff8a0b58ea _sigtramp + 26 3 llc 0x0000000109ba7698 void llvm::object_creator<std::vector<char const, std::allocator<char const> > >() + 29018 4 llc 0x0000000109bb44c8 char const std::find<char const, char>(char const, char const, char const&, std::random_access_iterator_tag) + 1756 5 llc 0x0000000109bb44b2 char const std::find<char const, char>(char const, char const*, char const&, std::random_access_iterator_tag) + 1734 6 llc 0x000000010962a492 std::vector<llvm::SDValue, std::allocator >::_M_insert_aux(gnu_cxx::normal_iterator<llvm::SDValue, std::vector<llvm::SDValue, std::allocator > >, llvm::SDValue const&) + 26142 7 llc 0x00000001098cc287 llvm::Pass llvm::callDefaultCtor() + 349 8 llc 0x00000001096268aa std::vector<llvm::SDValue, std::allocator >::_M_insert_aux(gnu_cxx::normal_iterator<llvm::SDValue, std::vector<llvm::SDValue, std::allocator > >, llvm::SDValue const&) + 10806 9 llc 0x00000001098cc698 llvm::Pass llvm::callDefaultCtor() + 1390 10 llc 0x0000000109627a77 std::vector<llvm::SDValue, std::allocator >::_M_insert_aux(gnu_cxx::normal_iterator<llvm::SDValue, std::vector<llvm::SDValue, std::allocator > >, llvm::SDValue const&) + 15363 11 llc 0x000000010984dfc4 std::_Rb_tree<llvm::SDNode const, std::pair<llvm::SDNode const const, std::string>, std::_Select1st<std::pair<llvm::SDNode const const, std::string> >, std::less<llvm::SDNode const>, std::allocator<std::pair<llvm::SDNode const const, std::string> > >::_M_erase(std::_Rb_tree_node<std::pair<llvm::SDNode const const, std::string> >) + 129430 12 llc 0x000000010983f16c std::_Rb_tree<llvm::SDNode const, std::pair<llvm::SDNode const const, std::string>, std::_Select1st<std::pair<llvm::SDNode const const, std::string> >, std::less<llvm::SDNode const>, std::allocator<std::pair<llvm::SDNode const const, std::string> > >::_M_erase(std::_Rb_tree_node<std::pair<llvm::SDNode const const, std::string> >) + 68414 13 llc 0x0000000109833d09 std::_Rb_tree<llvm::SDNode const, std::pair<llvm::SDNode const const, std::string>, std::_Select1st<std::pair<llvm::SDNode const const, std::string> >, std::less<llvm::SDNode const>, std::allocator<std::pair<llvm::SDNode const const, std::string> > >::_M_erase(std::_Rb_tree_node<std::pair<llvm::SDNode const const, std::string> >) + 22235 14 llc 0x000000010982f598 std::_Rb_tree<llvm::SDNode const, std::pair<llvm::SDNode const const, std::string>, std::_Select1st<std::pair<llvm::SDNode const const, std::string> >, std::less<llvm::SDNode const>, std::allocator<std::pair<llvm::SDNode const const, std::string> > >::_M_erase(std::_Rb_tree_node<std::pair<llvm::SDNode const const, std::string> >) + 3946 15 llc 0x000000010982ed1f std::_Rb_tree<llvm::SDNode const, std::pair<llvm::SDNode const const, std::string>, std::_Select1st<std::pair<llvm::SDNode const const, std::string> >, std::less<llvm::SDNode const>, std::allocator<std::pair<llvm::SDNode const const, std::string> > >::_M_erase(std::_Rb_tree_node<std::pair<llvm::SDNode const const, std::string> >) + 1777 16 llc 0x000000010985f2fd std::vector<llvm::GCRoot, std::allocator >::_M_insert_aux(gnu_cxx::normal_iterator<llvm::GCRoot*, std::vector<llvm::GCRoot, std::allocator > >, llvm::GCRoot const&) + 22415 17 llc 0x000000010985f0b6 std::vector<llvm::GCRoot, std::allocator >::_M_insert_aux(gnu_cxx::normal_iterator<llvm::GCRoot, std::vector<llvm::GCRoot, std::allocator > >, llvm::GCRoot const&) + 21832 18 llc 0x000000010985db9e std::vector<llvm::GCRoot, std::allocator >::_M_insert_aux(__gnu_cxx::__normal_iterator<llvm::GCRoot, std::vector<llvm::GCRoot, std::allocator > >, llvm::GCRoot const&) + 16432 19 llc 0x0000000109923be2 std::vector<llvm::MachineBasicBlock, std::allocator<llvm::MachineBasicBlock> >::_M_fill_insert(__gnu_cxx::__normal_iterator<llvm::MachineBasicBlock*, std::vector<llvm::MachineBasicBlock, std::allocator<llvm::MachineBasicBlock> > >, unsigned long, llvm::MachineBasicBlock const&) + 1416 20 llc 0x0000000109b43ee0 llvm::SymbolTableListTraits<llvm::GlobalAlias, llvm::Module>::toPtr(llvm::ValueSymbolTable) + 17988 21 llc 0x0000000109b44084 llvm::SymbolTableListTraits<llvm::GlobalAlias, llvm::Module>::toPtr(llvm::ValueSymbolTable) + 18408 22 llc 0x0000000109b441bb llvm::SymbolTableListTraits<llvm::GlobalAlias, llvm::Module>::toPtr(llvm::ValueSymbolTable) + 18719 23 llc 0x0000000109b4451e llvm::SymbolTableListTraits<llvm::GlobalAlias, llvm::Module>::toPtr(llvm::ValueSymbolTable) + 19586 24 llc 0x0000000109b44637 llvm::SymbolTableListTraits<llvm::GlobalAlias, llvm::Module>::toPtr(llvm::ValueSymbolTable*) + 19867 25 llc 0x000000010949e552 26 libdyld.dylib 0x00007fff954fc7e1 start + 0 27 libdyld.dylib 0x0000000000000002 start + 18446603338011129889 Stack dump:

  1. Program arguments: llc ice.bc
  2. Running pass 'Function Pass Manager' on module 'ice.bc'.
  3. Running pass 'ARM Instruction Selection' on function '@doOpAssign' Illegal instruction: 4
kaomoneus commented 11 years ago

Fixed in r181148: I have fixed byval attribute support for ARM back-end. Would you try it now, please, without patch, I had attached previously?

redstar commented 11 years ago

The problem was found while porting LDC to the ARM platform. At least I can now compile D code without getting the assertion. Thank you!

kaomoneus commented 11 years ago

FIX 2013-03-21 Please review the fix in attachment. I'm wandering why that case didn't fire before :-) One more question to all: what was real purpose of "assert(size >= excess && "expected larger existing stack allocation");" ?

kaomoneus commented 11 years ago

Hi all! Reduced test-case:

[code] ; ModuleID = 'bugpoint-reduced-simplified.bc' target triple = "arm--linux-gnueabihf"

%artz = type { i32 }

declare void @​foo(%artz* byval)

define void @​doFoo() { call void @​foo(%artz* byval undef) ret void } [/code]

Or with data:

[code] ; ModuleID = 'bugpoint-reduced-simplified.bc' target triple = "arm--linux-gnueabihf"

%artz = type { i32 }

declare void @​foo(%artz* byval)

define void @​doFoo() { %s = alloca %artz %field = getelementptr %artz %s, i64 0, i32 0 store i32 777, i32 %field call void @​foo(%artz* byval %s) ret void } [/code]