[LLVMbugs] [Bug 15185] New: opt -mergefunc trips assertion error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 6 13:54:48 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15185

            Bug ID: 15185
           Summary: opt -mergefunc trips assertion error
           Product: tools
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: caustin at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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>
>::CreateCast(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*,
llvm::Twine const&) + 260
10 opt               0x0000000100af11fa llvm::IRBuilder<false,
llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<false>
>::CreateBitCast(llvm::Value*, llvm::Type*, llvm::Twine const&) + 58
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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130206/4993ec19/attachment.html>


More information about the llvm-bugs mailing list