[llvm-dev] How to invoke simplifycfg from code

Russell Wallace via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 20 07:40:11 PDT 2015


Done.

https://llvm.org/bugs/show_bug.cgi?id=24885

On Sun, Sep 20, 2015 at 3:01 PM, Hal Finkel <hfinkel at anl.gov> wrote:

> ----- Original Message -----
> > From: "Russell Wallace" <russell.wallace at gmail.com>
> > To: "Hal Finkel" <hfinkel at anl.gov>
> > Cc: "llvm-dev" <llvm-dev at lists.llvm.org>
> > Sent: Sunday, September 20, 2015 8:34:07 AM
> > Subject: Re: [llvm-dev] How to invoke simplifycfg from code
> >
> > Yes, that is what I was thinking. Should I report it as a bug?
> >
>
> Please do. If you can attach the relevant IR it will be easier for us to
> figure out what is going on.
>
>  -Hal
>
> >
> >
> > On Sun, Sep 20, 2015 at 2:31 PM, Hal Finkel < hfinkel at anl.gov >
> > wrote:
> >
> >
> > ----- Original Message -----
> > > From: "Russell Wallace" < russell.wallace at gmail.com >
> > > To: "Hal Finkel" < hfinkel at anl.gov >
> > > Cc: "llvm-dev" < llvm-dev at lists.llvm.org >
> > > Sent: Sunday, September 20, 2015 8:15:19 AM
> > > Subject: Re: [llvm-dev] How to invoke simplifycfg from code
> > >
> > >
> > > Okay, as far as I can see looking through the output of that, the
> > > empty block isn't created near the end, it exists at the start and
> > > never goes away.
> > >
> >
> > But running SimplifyCFG has a stand-alone pass removes it? That seems
> > like a bug.
> >
> > -Hal
> >
> >
> >
> > >
> > >
> > > On Sun, Sep 20, 2015 at 1:36 PM, Hal Finkel < hfinkel at anl.gov >
> > > wrote:
> > >
> > >
> > > Hi Russell,
> > >
> > > Can you run your IR though opt with -O3 and -print-after-all and
> > > see
> > > when the block becomes empty?
> > > PassManagerBuilder::populateModulePassManager has, fairly near the
> > > end:
> > >
> > > MPM.add(createCFGSimplificationPass());
> > >
> > > but, other things do run afterward. Maybe we need another one of
> > > these closer to the end?
> > >
> > > One other thing to realize is that an empty block like this might
> > > not
> > > actually turn up in any generated machine code because of how
> > > MachineBlockPlacement (and other MI-level passes) work.
> > >
> > > -Hal
> > >
> > >
> > >
> > > ----- Original Message -----
> > > > From: "Russell Wallace via llvm-dev" < llvm-dev at lists.llvm.org >
> > > > To: "llvm-dev" < llvm-dev at lists.llvm.org >
> > > > Sent: Sunday, September 20, 2015 1:28:56 AM
> > > > Subject: [llvm-dev] How to invoke simplifycfg from code
> > > >
> > > > Simplifycfg doesn't get run by default even with -O3, but 'opt
> > > > -simplifycfg' can do it. I'm looking to add this functionality to
> > > > an
> > > > optimizer program that uses the llvm libraries. What's the best
> > > > way
> > > > to do this? I don't really mind whether it becomes available as a
> > > > command line option as in opt, or I need to hardcode it as always
> > > > on.
> > > >
> > > >
> > > > To make it available as a command line option... I'm looking at
> > > > the
> > > > code for opt, but it makes no reference to simplifycfg anywhere
> > > > in
> > > > the code. I'm guessing it does something else that gets that
> > > > option
> > > > linked in and somehow thereby connects that to activating the
> > > > actual
> > > > pass; how is this done?
> > > >
> > > >
> > > > Alternatively in an attempt to hardwire it I got as far as
> > > > FPM.add(new SimplifyCFGPass); but that fails to compile because
> > > > SimplifyCFGPass isn't of a compatible type, which indeed it
> > > > isn't;
> > > > what should I be doing here?
> > >
> > >
> > > > _______________________________________________
> > > > LLVM Developers mailing list
> > > > llvm-dev at lists.llvm.org
> > > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> > > >
> > >
> > > --
> > > Hal Finkel
> > > Assistant Computational Scientist
> > > Leadership Computing Facility
> > > Argonne National Laboratory
> > >
> > >
> >
> > --
> > Hal Finkel
> > Assistant Computational Scientist
> > Leadership Computing Facility
> > Argonne National Laboratory
> >
> >
>
> --
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150920/f74401d7/attachment.html>


More information about the llvm-dev mailing list