Skip to content

Assertion "getOperand() out of range" hits in Constants.h #11185

@llvmbot

Description

@llvmbot
Bugzilla Link 10813
Resolution FIXED
Resolved on Sep 03, 2011 09:20
Version trunk
OS All
Attachments test case
Reporter LLVM Bugzilla Contributor

Extended Description

With the attached test case, I get the following assertion failure with LLVM top-of-tree:

% opt -O1 bug.ll -o /dev/null
Assertion failed: (i_nocapture < OperandTraits::operands(this) && "getOperand() out of range!"), function getOperand, file /Users/mmp/llvm-dev-src/include/llvm/Constants.h, line 504.
0 opt 0x00000001004f9132 llvm::PrettyStackTraceProgram::~PrettyStackTraceProgram() + 11394
1 opt 0x00000001004fa0b3 llvm::PrettyStackTraceProgram::~PrettyStackTraceProgram() + 15363
2 libSystem.B.dylib 0x00007fff82dd21ba _sigtramp + 26
3 libSystem.B.dylib 0x00000001008044f0 _sigtramp + 2107843408
4 opt 0x00000001004f95b2 llvm::PrettyStackTraceProgram::~PrettyStackTraceProgram() + 12546
5 opt 0x00000001003bdbca llvm::cast_retty<llvm::IntrinsicInst, llvm::ilist_iteratorllvm::Instruction >::ret_type llvm::cast<llvm::IntrinsicInst, llvm::ilist_iteratorllvm::Instruction >(llvm::ilist_iteratorllvm::Instruction const&) + 4698
6 opt 0x00000001003cef4c llvm::cast_retty<llvm::ArrayType, llvm::CompositeType*>::ret_type llvm::cast<llvm::ArrayType, llvm::CompositeType*>(llvm::CompositeType* const&) + 25916
7 opt 0x0000000100248d5d llvm::sys::Path llvm::WriteGraph<llvm::Function const*>(llvm::Function const* const&, std::string const&, bool, std::string const&) + 17853
8 opt 0x000000010024c4fb llvm::sys::Path llvm::WriteGraph<llvm::Function const*>(llvm::Function const* const&, std::string const&, bool, std::string const&) + 32091
9 opt 0x0000000100272856 llvm::Statistic::operator++() + 34422
10 opt 0x00000001001e440e llvm::LoopBase<llvm::BasicBlock, llvm::Loop>::getExitingBlocks(llvm::SmallVectorImplllvm::BasicBlock*&) const + 13182
11 opt 0x00000001000c5c13 llvm::DenseMap<llvm::SCEV const*, llvm::SmallBitVector, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::DenseMapInfollvm::SmallBitVector >::clear() + 4227
12 opt 0x0000000100295a63 llvm::LoopInfo::releaseMemory() + 4531
13 opt 0x0000000100488880 llvm::BasicBlockPass::~BasicBlockPass() + 40576
14 opt 0x0000000100219b01 std::_Rb_tree<llvm::Function const*, std::pair<llvm::Function const* const, llvm::CallGraphNode*>, std::_Select1st<std::pair<llvm::Function const* const, llvm::CallGraphNode*> >, std::less<llvm::Function const*>, std::allocator<std::pair<llvm::Function const* const, llvm::CallGraphNode*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<llvm::Function const* const, llvm::CallGraphNode*> >, std::pair<llvm::Function const* const, llvm::CallGraphNode*> const&) + 7649
15 opt 0x000000010021a341 std::_Rb_tree<llvm::Function const*, std::pair<llvm::Function const* const, llvm::CallGraphNode*>, std::_Select1st<std::pair<llvm::Function const* const, llvm::CallGraphNode*> >, std::less<llvm::Function const*>, std::allocator<std::pair<llvm::Function const* const, llvm::CallGraphNode*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<llvm::Function const* const, llvm::CallGraphNode*> >, std::pair<llvm::Function const* const, llvm::CallGraphNode*> const&) + 9761
16 opt 0x000000010048815f llvm::BasicBlockPass::~BasicBlockPass() + 38751
17 opt 0x0000000100488461 llvm::BasicBlockPass::~BasicBlockPass() + 39521
18 opt 0x000000010048857d llvm::BasicBlockPass::~BasicBlockPass() + 39805
19 opt 0x000000010000cee7 llvm::scc_iterator<llvm::Function*, llvm::GraphTraitsllvm::Function* > llvm::scc_beginllvm::Function*(llvm::Function* const&) + 15255
20 opt 0x00000001000010e4
21 opt 0x0000000000000005
Stack dump:
0. Program arguments: opt -O1 bug.ll -o /dev/null

  1. Running pass 'CallGraph Pass Manager' on module 'bug.ll'.
  2. Running pass 'Loop Pass Manager' on function '@"f_fu___REFUf[]REFUf[]Uf"'
  3. Running pass 'Unroll loops' on basic block '%pl_loop.i964'

The stack trace above looks bogus to me; when I hit this assertion running optimization passes directly in the ispc compiler, I get the more reasonable looking:

Assertion failed: (i_nocapture < OperandTraits::operands(this) && "getOperand() out of range!"), function getOperand, file /Users/mmp/llvm-dev-src/include/llvm/Constants.h, line 504.
0 ispc 0x00000001012ca8e2 PrintStackTrace(void*) + 34
1 ispc 0x00000001012cb863 SignalHandler(int) + 707
2 libSystem.B.dylib 0x00007fff82dd21ba _sigtramp + 26
3 libSystem.B.dylib 0x0000000102201f50 _sigtramp + 2135096752
4 ispc 0x00000001012cad62 __assert_rtn + 66
5 ispc 0x000000010113280a llvm::ConstantFoldExtractElementInstruction(llvm::Constant*, llvm::Constant*) + 426
6 ispc 0x0000000101143b8c llvm::ConstantExpr::getExtractElement(llvm::Constant*, llvm::Constant*) + 92
7 ispc 0x000000010100f98d llvm::ConstantFoldInstOperands(unsigned int, llvm::Type*, llvm::ArrayRefllvm::Constant*, llvm::TargetData const*) + 621
8 ispc 0x000000010101312b llvm::ConstantFoldInstruction(llvm::Instruction*, llvm::TargetData const*) + 683
9 ispc 0x00000001010393f6 llvm::SimplifyInstruction(llvm::Instruction*, llvm::TargetData const*, llvm::DominatorTree const*) + 70
10 ispc 0x0000000100faad7e llvm::UnrollLoop(llvm::Loop*, unsigned int, unsigned int, unsigned int, llvm::LoopInfo*, llvm::LPPassManager*) + 10078
11 ispc 0x0000000100ea3243 (anonymous namespace)::LoopUnroll::runOnLoop(llvm::Loop*, llvm::LPPassManager&) + 2035
12 ispc 0x000000010105d2e3 llvm::LPPassManager::runOnFunction(llvm::Function&) + 1523
13 ispc 0x00000001011fe3e0 llvm::FPPassManager::runOnFunction(llvm::Function&) + 752
14 ispc 0x0000000100fe0991 (anonymous namespace)::CGPassManager::RunPassOnSCC(llvm::Pass*, llvm::CallGraphSCC&, llvm::CallGraph&, bool&, bool&) + 273
15 ispc 0x0000000100fe11d1 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) + 977
16 ispc 0x00000001011fdcbf llvm::MPPassManager::runOnModule(llvm::Module&) + 607
17 ispc 0x00000001011fdfc1 llvm::PassManagerImpl::run(llvm::Module&) + 177
18 ispc 0x00000001011fe0dd llvm::PassManager::run(llvm::Module&) + 13
19 ispc 0x000000010004cecc Optimize(llvm::Module*, int) + 1710
20 ispc 0x0000000100043d89 Module::CompileFile() + 579
21 ispc 0x000000010003e5ae main + 2774
22 ispc 0x0000000100001734 start + 52
23 ispc 0x0000000000000007 start + 4294961415
Stack dump:
0. Program arguments: ispc -O2 --emit-llvm tests/scatter-int8.ispc --target=sse4 -o bug.bc

  1. Running pass 'CallGraph Pass Manager' on module 'tests/scatter-int8.ispc'.
  2. Running pass 'Loop Pass Manager' on function '@"f_fu___REFUf[]REFUf[]Uf"'
  3. Running pass 'Unroll loops' on basic block '%pl_loop.i'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions