[llvm] 777f91f - [AMDGPU] Simplify MergeInfo calculations. NFC.
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 29 11:59:29 PDT 2020
Author: Jay Foad
Date: 2020-04-29T19:58:06+01:00
New Revision: 777f91f47e7cd936fb1dfb5c55e87cfd2781e994
URL: https://github.com/llvm/llvm-project/commit/777f91f47e7cd936fb1dfb5c55e87cfd2781e994
DIFF: https://github.com/llvm/llvm-project/commit/777f91f47e7cd936fb1dfb5c55e87cfd2781e994.diff
LOG: [AMDGPU] Simplify MergeInfo calculations. NFC.
This makes the definition and uses of NewUB more symmetrical, and makes
it clear that ScoreLBs[T] does not change.
Added:
Modified:
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index 48f0995b53cd..43c8b8e2c97b 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -1299,17 +1299,17 @@ bool WaitcntBrackets::merge(const WaitcntBrackets &Other) {
// Merge scores for this counter
const uint32_t MyPending = ScoreUBs[T] - ScoreLBs[T];
const uint32_t OtherPending = Other.ScoreUBs[T] - Other.ScoreLBs[T];
+ const uint32_t NewUB = ScoreLBs[T] + std::max(MyPending, OtherPending);
+ if (NewUB < ScoreLBs[T])
+ report_fatal_error("waitcnt score overflow");
+
MergeInfo M;
M.OldLB = ScoreLBs[T];
M.OtherLB = Other.ScoreLBs[T];
- M.MyShift = OtherPending > MyPending ? OtherPending - MyPending : 0;
- M.OtherShift = ScoreUBs[T] - Other.ScoreUBs[T] + M.MyShift;
+ M.MyShift = NewUB - ScoreUBs[T];
+ M.OtherShift = NewUB - Other.ScoreUBs[T];
- const uint32_t NewUB = ScoreUBs[T] + M.MyShift;
- if (NewUB < ScoreUBs[T])
- report_fatal_error("waitcnt score overflow");
ScoreUBs[T] = NewUB;
- ScoreLBs[T] = std::min(M.OldLB + M.MyShift, M.OtherLB + M.OtherShift);
StrictDom |= mergeScore(M, LastFlat[T], Other.LastFlat[T]);
More information about the llvm-commits
mailing list