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