Index: llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp =================================================================== --- llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp +++ llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -280,8 +280,9 @@ // Skip inline assembly calls. if (CI && CI->isInlineAsm()) continue; - assert(CalledValue && !isa(CalledValue) && - "Expected indirect call"); + // Skip direct calls. + if (!CalledValue || isa(CalledValue)) + continue; uint32_t NumVals, NumCandidates; uint64_t TotalCount; Index: llvm/trunk/test/Bitcode/thinlto-function-summary-callgraph-cast.ll =================================================================== --- llvm/trunk/test/Bitcode/thinlto-function-summary-callgraph-cast.ll +++ llvm/trunk/test/Bitcode/thinlto-function-summary-callgraph-cast.ll @@ -5,8 +5,10 @@ ; CHECK: +; "op7" is a call to "callee" function. +; CHECK-NEXT: +; "another_caller" has only references but no calls. +; CHECK-NEXT: ; CHECK-NEXT: ; CHECK-NEXT: @@ -21,6 +23,12 @@ ret void } +define void @another_caller() { + ; Test calls that aren't handled either as direct or indirect. + call void select (i1 icmp eq (i32* @global, i32* null), void ()* @f, void ()* @g)() + ret void +} + declare void @callee(...) @analias = alias void (...), bitcast (void ()* @aliasee to void (...)*) @@ -29,3 +37,7 @@ entry: ret void } + +declare void @f() +declare void @g() +@global = extern_weak global i32