[PATCH] Partial fix for bug 22589
Sanjoy Das
sanjoy at playingwithpointers.com
Tue Feb 17 22:26:34 PST 2015
================
Comment at: lib/Transforms/Utils/LoopUnrollRuntime.cpp:124
@@ -118,1 +123,3 @@
+ new ICmpInst(InsertPt, ICmpInst::ICMP_ULT, BECount,
+ ConstantInt::get(BECount->getType(), Count - 1));
BasicBlock *Exit = L->getUniqueExitBlock();
----------------
majnemer wrote:
> If `Count` is `1`, then we are going to have `BECount u< 0`. Is this possible? If not, we should assert.
I think that case is fine since if `Count` is `1` then we *should* unconditionally branch to the original loop. The invariant (AFAICT!) is that we branch to the original loop when the number of iterations that remain is a multiple of `Count`. That is always true for `Count == 1`.
I could add an assert but I'm not sure if there are edge cases where this code is called with `Count == 1`.
================
Comment at: lib/Transforms/Utils/LoopUnrollRuntime.cpp:322
@@ +321,3 @@
+ // BEWidth`.
+ if (static_cast<unsigned long long>(Count) > (1ULL << BEWidth))
+ return false;
----------------
majnemer wrote:
> Using `uint64_t` instead of `unsigned long long` might be a little more concise.
Will do.
http://reviews.llvm.org/D7715
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list