[LLVMdev] Possible typo in LoopUnrollPass.cpp

Brendon Cahoon bcahoon at codeaurora.org
Tue Apr 3 10:04:15 PDT 2012


Hi Ether,

I think you're correct.  The references to CurrentThreshold that you've
pointed out should be replaced with Threshold.

-- Brendon

--
Qualcomm Innovation Center, Inc is a member of Code Aurora Forum

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Hongbin Zheng
Sent: Monday, April 02, 2012 11:56 PM
To: LLVM Developers Mailing List
Subject: [LLVMdev] Possible typo in LoopUnrollPass.cpp

hi,

In "LoopUnrollPass.cpp", when trying to reduce unroll count to meet the
unroll threshold requirement in line 200 and line 206,  variable
"CurrentThreshold" is used in the computation, instead of the variable
"Threshold", which is defined by:

  // Determine the current unrolling threshold.  While this is normally set
  // from UnrollThreshold, it is overridden to a smaller value if the
current
  // function is marked as optimize-for-size, and the unroll threshold was
  // not user specified.
  unsigned Threshold = CurrentThreshold;
  if (!UserThreshold &&
      Header->getParent()->hasFnAttr(Attribute::OptimizeForSize))
    Threshold = OptSizeUnrollThreshold;

As a result, the OptimizeForSize attribute is ignored when the pass
calculating the reduced count, which is not I expected.

Am i correct or i missed something? If i am correct, i am going to fix this.

best regards
ether

ps: the code contains typo
      if (TripCount) {
        // Reduce unroll count to be modulo of TripCount for partial
unrolling
        Count = CurrentThreshold / LoopSize;
<--------------------------should use Threshold
        while (Count != 0 && TripCount%Count != 0)
          Count--;
      }
      else if (UnrollRuntime) {
        // Reduce unroll count to be a lower power-of-two value
        while (Count != 0 && Size > CurrentThreshold) {
<--------------------------should use Threshold
          Count >>= 1;
          Size = LoopSize*Count;
        }
      }
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list