[PATCH] Partial fix for bug 22589
Sanjoy Das
sanjoy at playingwithpointers.com
Tue Feb 17 21:31:46 PST 2015
================
Comment at: lib/Transforms/Utils/LoopUnrollRuntime.cpp:122
@@ -118,1 +121,3 @@
+ new ICmpInst(InsertPt, ICmpInst::ICMP_ULT, BECount,
+ ConstantInt::get(BECount->getType(), Count - 1));
BasicBlock *Exit = L->getUniqueExitBlock();
----------------
majnemer wrote:
> Should we assert that Count is > 0?
That's a good idea, will do.
================
Comment at: lib/Transforms/Utils/LoopUnrollRuntime.cpp:314
@@ -309,3 +313,3 @@
// Count is the loop unroll factor, the number of extra copies added + 1.
if ((Count & (Count-1)) != 0)
return false;
----------------
majnemer wrote:
> Can we use isPowerOf2_32 here?
Is it okay to assume that `unsigned` is 32 bits long? Can it be 64 bits on a platform LLVM runs on?
================
Comment at: lib/Transforms/Utils/LoopUnrollRuntime.cpp:319
@@ +318,3 @@
+ // comment on ModVal below.
+ if (Log2_64(Count) > BEWidth)
+ return false;
----------------
majnemer wrote:
> Would it be cheaper to do `Count > (1ULL << BEWidth)`? If it isn't, could we use Log2_32? Count is unsigned.
Changed to `static_cast<unsigned long long>(Count) > (1ULL << BEWidth)`.
================
Comment at: lib/Transforms/Utils/LoopUnrollRuntime.cpp:346
@@ -336,1 +345,3 @@
+ Value *BECount = Expander.expandCodeFor(BECountSC, BECountSC->getType(),
+ PreHeaderBR);
----------------
hfinkel wrote:
> Extra indentation.
Fixed
http://reviews.llvm.org/D7715
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list