[LLVMdev] weird issue with mem2reg

Chris Lattner sabre at nondot.org
Wed Jun 23 15:55:02 PDT 2004


On Wed, 23 Jun 2004, Patrick Meredith wrote:

> MetaSplit is an anlysis I just finished writing.  It doesn't alter anything,
> all it does is build a set of "program instructions".  For some reason even
> though if I run it with any other combination of passes I've found, anytime
> I run it with mem2reg I get a seg fault in dyn_cast!  Here's output:
>
> Starting program:
> /mounts/zion/disks/0/localhome/pmeredit/llvm/tools/Debug/opt -load
> ../Debug/libmetasplit.so -mem2reg -metasplit < test3.s.bc > out.bc

This is a crash in your pass.  Try running:

opt -mem2reg test3.s.bc -o tmp.bc
opt -load ... -metasplit tmp.bc -o out.bc

I suspect that it will still crash in only your pass (aka, the bug is
yours :)

Regardless I recommend trying out bugpoint for something like this.  Try
running:

bugpoint -load ... -mem2reg -metasplit test3.s.bc

and it will probably tell you what I just did, and give you a better
testcase. :)

-Chris


> Program received signal SIGSEGV, Segmentation fault.
> 0x083b6a22 in llvm::isa_impl_wrap<llvm::Instruction, llvm::Value const,
> llvm::Value const>::doit(llvm::Value const&) (Val=@0x894e850)
>     at
> /mounts/zion/disks/0/localhome/pmeredit/llvm/include/Support/Casting.h:69
> 69          return isa_impl<To,FromTy>(Val);
> (gdb) bt
> #0  0x083b6a22 in llvm::isa_impl_wrap<llvm::Instruction, llvm::Value const,
> llvm::Value const>::doit(llvm::Value const&) (Val=@0x894e850)
>     at
> /mounts/zion/disks/0/localhome/pmeredit/llvm/include/Support/Casting.h:69
> #1  0x083b69f7 in isa<llvm::Instruction> (Val=@0x894e850) at
> /mounts/zion/disks/0/localhome/pmeredit/llvm/include/Support/Casting.h:80
> #2  0x083b693f in isa<llvm::Instruction> (Val=@0x894e850) at
> /mounts/zion/disks/0/localhome/pmeredit/llvm/include/Support/Casting.h:90
> #3  0x083b6673 in isa<llvm::Instruction> (Val=0x894e850) at
> /mounts/zion/disks/0/localhome/pmeredit/llvm/include/Support/Casting.h:99
> #4  0x083b6379 in isa<llvm::Instruction, const llvm::Value*>
> (Val=@0xbf8000c0) at
> /mounts/zion/disks/0/localhome/pmeredit/llvm/include/Support/Casting.h:114
> #5  0x083b608f in llvm::CallInst::classof(llvm::Value const*) (V=0x894e850)
> at /mounts/zion/disks/0/localhome/pmeredit/llvm/include/llvm/iOther.h:110
> #6  0x08499213 in isa_impl<llvm::CallInst, llvm::Value> (Val=@0x894e850) at
> /mounts/zion/disks/0/localhome/pmeredit/llvm/include/Support/Casting.h:52
> #7  0x08499157 in llvm::isa_impl_wrap<llvm::CallInst, llvm::Value const,
> llvm::Value const>::doit(llvm::Value const&) (Val=@0x894e850)
>     at
> /mounts/zion/disks/0/localhome/pmeredit/llvm/include/Support/Casting.h:69
> #8  0x08498ea7 in isa<llvm::CallInst> (Val=@0x894e850) at
> /mounts/zion/disks/0/localhome/pmeredit/llvm/include/Support/Casting.h:80
> #9  0x08498b79 in isa<llvm::CallInst> (Val=0x894e850) at
> /mounts/zion/disks/0/localhome/pmeredit/llvm/include/Support/Casting.h:99
> #10 0x4001d1f6 in isa<llvm::CallInst> (Val=@0xbf800170) at
> /localhome/pmeredit/llvm/include/Support/Casting.h:90
> #11 0x4001cfb3 in llvm::isa_impl_wrap<llvm::CallInst, llvm::Use const,
> llvm::Value*>::doit(llvm::Use const&) (Val=@0xbf800200)
>     at /localhome/pmeredit/llvm/include/Support/Casting.h:60
> #12 0x4001ca1c in isa<llvm::CallInst> (Val=@0xbf800200) at
> /localhome/pmeredit/llvm/include/Support/Casting.h:80
> #13 0x4001c1ca in isa<llvm::CallInst, llvm::Use> (Val=@0xbf800200) at
> /localhome/pmeredit/llvm/include/Support/Casting.h:114
> #14 0x4001baaa in dyn_cast<llvm::CallInst, llvm::Use> (Val={Val = 0x894e850,
> U = 0x8917e48, Prev = 0x895a240, Next = 0x894e880})
>     at /localhome/pmeredit/llvm/include/Support/Casting.h:223
> #15 0x4001af72 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x8917e48) at MetaSplit.cpp:79
> #16 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x895ff40) at MetaSplit.cpp:88
> #17 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x8930610) at MetaSplit.cpp:88
> #18 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x89609a8) at MetaSplit.cpp:88
> #19 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x8930610) at MetaSplit.cpp:88
> #20 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x89609a8) at MetaSplit.cpp:88
> #21 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x8930610) at MetaSplit.cpp:88
> #22 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x89609a8) at MetaSplit.cpp:88
> #23 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x8930610) at MetaSplit.cpp:88
> #24 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x89609a8) at MetaSplit.cpp:88
> #25 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x8930610) at MetaSplit.cpp:88
> #26 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x89609a8) at MetaSplit.cpp:88
> #27 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x8930610) at MetaSplit.cpp:88
> #28 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x89609a8) at MetaSplit.cpp:88
> #29 0x4001b049 in (anonymous
> namespace)::MetaSplit::handleProgramUses(llvm::Value*) (this=0x893e998,
> V=0x8930610) at MetaSplit.cpp:88
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list