[LLVMdev] weird issue with mem2reg, still

Patrick Meredith pmeredit at uiuc.edu
Wed Jun 23 16:32:13 PDT 2004


Somehow it fails with operand out of bounds when the number of operands is 2
and I am asking for the second operand.

----- Original Message ----- 
From: "Chris Lattner" <sabre at nondot.org>
To: <llvmdev at cs.uiuc.edu>
Sent: Wednesday, June 23, 2004 4:24 PM
Subject: Re: [LLVMdev] weird issue with mem2reg, should have guessed


> On Wed, 23 Jun 2004, Patrick Meredith wrote:
>
> > What's different about code that's been mem2reg'd from straight front
end
> > code, or anything that mem2reg hasn't been run on?  PHINODES!
>
> Yup, front-ends generally don't produce SSA form. :)
>
> > It appears to be crashing when I try to cast a Value* that's really a
> > BB* (from the PHInode operands) to a User*, insteresting since I am
> > dyn_casting.  I just caught this on cerr though (printing out what the
> > Value* was each time).
>
> Yeah, you shouldn't do that. :)  Also, you should use the 'cast' template
> instead of the dyn_cast template unless you are prepared to handle the
> null return value.  Use 'cast' when you _know_ that something is a
> particular type.  This will give you a nice assertion failure instead of a
> segfault when you deref the null pointer :)
>
> > Let me check bugpoint.
>
> Cool, post the testcase it produces.  Hopefully it will be small :)
>
> -Chris
>
> > ----- Original Message -----
> > From: "Misha Brukman" <brukman at uiuc.edu>
> > To: <llvmdev at cs.uiuc.edu>
> > Sent: Wednesday, June 23, 2004 3:56 PM
> > Subject: Re: [LLVMdev] weird issue with mem2reg
> >
> >
> > > On Wed, Jun 23, 2004 at 03:50:09PM -0500, 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:
> > >
> > > Since the crash is after your code is entered, the problem is probably
> > > not in mem2reg, but in your pass.  To see if that's the case, you can
do
> > > this:
> > >
> > > % opt -mem2reg < orig.bc > m2r.bc
> > > % opt -load=... -metasplit < m2r.bc > output.bc
> > >
> > > And see if it crashes in mem2reg or in your pass.  To narrow your
> > > testcase down further, we recommend the use of bugpoint, the automatic
> > > test case reducer:
> > >
> > >   http://llvm.cs.uiuc.edu/docs/HowToSubmitABug.html
> > >
> > > In this case, this should work:
> > >
> > > % bugpoint -load=... -mem2reg -metasplit orig.bc
> > >
> > > --
> > > Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu
> > >
> > > _______________________________________________
> > > LLVM Developers mailing list
> > > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> > > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
> >
> > _______________________________________________
> > 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/
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list