File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -380,14 +380,17 @@ namespace llvm {
380
380
}
381
381
}
382
382
383
- int estimateUnrolledInstCount = (instCount + sendMessage * 4 ) * TripCount;
384
- int unrollLimitInstCount = MAX (LoopUnrollThreshold - totalInstCountInShader, 0 );
383
+ unsigned int estimateUnrolledInstCount = (instCount + sendMessage * 4 ) * TripCount;
384
+ unsigned int unrollLimitInstCount = LoopUnrollThreshold > totalInstCountInShader ? LoopUnrollThreshold - totalInstCountInShader : 0 ;
385
+ bool limitUnrolling = (estimateUnrolledInstCount > unrollLimitInstCount) ||
386
+ (TripCount > unrollLimitInstCount) ||
387
+ (instCount + sendMessage * 4 > unrollLimitInstCount);
385
388
386
389
// if the loop doesn't have sample, skip the unrolling parameter change
387
390
if (!sendMessage)
388
391
{
389
392
// if the estimated unrolled instruction count is larger than the unrolling threshold, limit unrolling.
390
- if (estimateUnrolledInstCount > unrollLimitInstCount )
393
+ if (limitUnrolling )
391
394
{
392
395
UP.Count = MIN (unrollLimitInstCount / (instCount + sendMessage * 4 ), 4 );
393
396
if (TripCount != 0 )
@@ -399,7 +402,7 @@ namespace llvm {
399
402
}
400
403
401
404
// if the TripCount is known, and the estimated unrolled count exceed LoopUnrollThreshold, set the unrolling count to 4
402
- if (estimateUnrolledInstCount > unrollLimitInstCount )
405
+ if (limitUnrolling )
403
406
{
404
407
UP.Count = MIN (TripCount, 4 );
405
408
UP.MaxCount = UP.Count ;
You can’t perform that action at this time.
0 commit comments