[LLVMdev] What opt pass attempts implements this optimization?

Villmow, Micah Micah.Villmow at amd.com
Wed Oct 7 11:02:56 PDT 2009


Dan,
 After I sent out this email a co-worker pointed me to LoopUnswitch
optimization as being a possible culprit. We set it to zero and it no
longer generates all this code. I've attached optimized bc and
unoptimized bc for this specific example.

Micah

> -----Original Message-----
> From: Dan Gohman [mailto:gohman at apple.com]
> Sent: Tuesday, October 06, 2009 9:35 PM
> To: Villmow, Micah
> Cc: LLVM Developers Mailing List
> Subject: Re: [LLVMdev] What opt pass attempts implements this
> optimization?
> 
> 
> On Oct 6, 2009, at 4:28 PM, Villmow, Micah wrote:
> 
> > I have a very simple kernel that is generating very very bad code.
> >
> > The basic kernel pseudo-code is as follows:
> > forloop(1 to n) {
> >   forloop(0 to j) {
> >   A
> > }
> > B
> > }
> > C
> >
> > It is generating very ugly and inefficient code for a vector system
> > similar to the following pseudo-code:
> > if (n > 1) {
> >   if (j) {
> >                 forloop(1 to n) {
> >                                 forloop(0 to j) {
> >                                 A
> >                                 }
> >                                 B
> >                 }
> >                C
> >    } else {
> >                 forloop(1 to n) {
> >                                 B
> >                 }
> >                 C
> >    }
> > } else {
> > C
> > }
> 
> It's possible that there's something going on with loop unswitching
> here. Do you
> have a testcase which demonstrates this?
> 
> Dan
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: AESEncryptDecrypt-opt.bc
Type: application/octet-stream
Size: 26732 bytes
Desc: AESEncryptDecrypt-opt.bc
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091007/15ba61af/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AESEncryptDecrypt.bc
Type: application/octet-stream
Size: 7416 bytes
Desc: AESEncryptDecrypt.bc
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091007/15ba61af/attachment-0001.obj>


More information about the llvm-dev mailing list