[PATCH] Fix bug causing loop unrolling to be disabled in some cases for loops with '#pragma clang loop unroll_count(N)"

hfinkel at anl.gov hfinkel at anl.gov
Thu Jul 24 15:06:27 PDT 2014


----- Original Message -----
> From: "Hal Finkel" <hfinkel at anl.gov>
> To: reviews+D4662+public+09cbf8b56d9abfd0 at reviews.llvm.org
> Cc: llvm-commits at cs.uiuc.edu
> Sent: Thursday, July 24, 2014 5:02:48 PM
> Subject: Re: [PATCH] Fix bug causing loop unrolling to be disabled in some	cases for loops with '#pragma clang loop
> unroll_count(N)"
> 
> In true LLVM style, I ask for a 40-line test case for your one-line
> change ;)

To be clear, otherwise, LGTM!

Thanks,
Hal

> 
>  -Hal
> 
> ----- Original Message -----
> > From: "Mark Heffernan" <meheff at google.com>
> > To: meheff at google.com, hfinkel at anl.gov
> > Cc: llvm-commits at cs.uiuc.edu
> > Sent: Thursday, July 24, 2014 4:59:24 PM
> > Subject: [PATCH] Fix bug causing loop unrolling to be disabled in
> > some cases for loops with '#pragma clang loop
> > unroll_count(N)"
> > 
> > Hi hfinkel,
> > 
> > After unrolling a loop with llvm.loop.unroll.count metadata (unroll
> > factor hint) the loop unroller replaces the llvm.loop.unroll.count
> > metadata with llvm.loop.unroll.disable metadata to prevent any
> > subsequent unrolling passes from unrolling more than the hint
> > indicates.  However, if the unroll count metadata is shared between
> > loops then unrolling for these other loops will also be disabled.
> >  This small patch fixes that problem by adding the
> > llvm.loop.unroll.disable metadata to only the loop which was just
> > unrolled.
> > 
> > http://reviews.llvm.org/D4662
> > 
> > Files:
> >   lib/Transforms/Scalar/LoopUnrollPass.cpp
> > 
> > Index: lib/Transforms/Scalar/LoopUnrollPass.cpp
> > ===================================================================
> > --- lib/Transforms/Scalar/LoopUnrollPass.cpp
> > +++ lib/Transforms/Scalar/LoopUnrollPass.cpp
> > @@ -302,7 +302,6 @@
> >    // Set operand 0 to refer to the loop id itself.
> >    NewLoopID->replaceOperandWith(0, NewLoopID);
> >    L->setLoopID(NewLoopID);
> > -  LoopID->replaceAllUsesWith(NewLoopID);
> >  }
> >  
> >  unsigned LoopUnroll::selectUnrollCount(
> > 
> 
> --
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>

http://reviews.llvm.org/D4662






More information about the llvm-commits mailing list