<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - opt -mergefunc trips assertion error"
href="http://llvm.org/bugs/show_bug.cgi?id=15185">15185</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>opt -mergefunc trips assertion error
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>opt
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>caustin@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>We have found a crash bug in opt -mergefunc. It is hard to exactly figure out
what's causing the bug: we have not been able to find a small reproducible
case. This crash appears to be reproducible in LLVM 3.1, LLVM 3.2, and HEAD.
clang generated individual translation unit bitcode with -O3. All bitcodes
were linked together with llvm-link.
We then optimized the result with:
third-party/mac/clang+llvm-r174536-x86_64-apple-darwin11/bin/opt
-disable-inlining -targetlibinfo -no-aa -tbaa -basicaa -preverify -domtree
-verify -internalize -ipsccp -globalopt -constmerge -deadargelim -instcombine
-basiccg -prune-eh -globalopt -globaldce -basiccg -argpromotion -instcombine
-lazy-value-info -jump-threading -domtree -scalarrepl -basiccg -functionattrs
-globalsmodref-aa -domtree -loops -loop-simplify -licm -memdep -gvn -memdep
-memcpyopt -instcombine -lazy-value-info -jump-threading -simplifycfg
-globaldce -preverify -domtree -verify -internalize -globaldce -constmerge
-always-inline -o=inter.bc build/total.bc
This succeeds, but if we add one more optimization, -mergefunc, to the end, it
trips an assertion.
I have attached an inter.ll file that reproduces the failure:
caustin-mbp:~/tmp/build-debug-r174536
$ Debug+Asserts/bin/opt -mergefunc -o test.bc ~/Downloads/inter.bc
Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create,
file /Users/chad/tmp/llvm/lib/IR/Instructions.cpp, line 2295.
0 opt 0x0000000101397a25 llvm::sys::PrintStackTrace(__sFILE*) +
53
1 opt 0x0000000101397deb PrintStackTraceSignalHandler(void*) +
27
2 opt 0x000000010139814b SignalHandler(int) + 379
3 libSystem.B.dylib 0x00007fff87e261ba _sigtramp + 26
4 libSystem.B.dylib 0x00007fff87dcccdc szone_free_definite_size + 2083
5 opt 0x0000000101397e1b raise + 27
6 opt 0x0000000101397eda abort + 26
7 opt 0x0000000101397eb4 __assert_rtn + 132
8 opt 0x00000001012aed3e
llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*,
llvm::Twine const&, llvm::Instruction*) + 126
9 opt 0x0000000100af1614 llvm::IRBuilder<false,
llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<false>
<span class="quote">>::CreateCast(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*,</span >
llvm::Twine const&) + 260
10 opt 0x0000000100af11fa llvm::IRBuilder<false,
llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<false>
<span class="quote">>::CreateBitCast(llvm::Value*, llvm::Type*, llvm::Twine const&) + 58</span >
11 opt 0x0000000100aec826 (anonymous
namespace)::MergeFunctions::writeThunk(llvm::Function*, llvm::Function*) + 1142
12 opt 0x0000000100aec39e (anonymous
namespace)::MergeFunctions::writeThunkOrAlias(llvm::Function*, llvm::Function*)
+ 190
13 opt 0x0000000100aebbc1 (anonymous
namespace)::MergeFunctions::mergeTwoFunctions(llvm::Function*, llvm::Function*)
+ 529
14 opt 0x0000000100ae88c7 (anonymous
namespace)::MergeFunctions::insert((anonymous namespace)::ComparableFunction&)
+ 695
15 opt 0x0000000100ae828a (anonymous
namespace)::MergeFunctions::runOnModule(llvm::Module&) + 1034
16 opt 0x00000001012e3088
llvm::MPPassManager::runOnModule(llvm::Module&) + 728
17 opt 0x00000001012e3a52
llvm::PassManagerImpl::run(llvm::Module&) + 354
18 opt 0x00000001012e3d4d llvm::PassManager::run(llvm::Module&) +
29
19 opt 0x00000001000120b5 main + 8821
20 opt 0x0000000100001134 start + 52
21 opt 0x0000000000000005 start + 4294962949
Stack dump:
0. Program arguments: Debug+Asserts/bin/opt -mergefunc -o test.bc
/Users/chad/Downloads/inter.bc
1. Running pass 'Merge Functions' on module
'/Users/chad/Downloads/inter.bc'.
Illegal instruction</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>