Skip to content

Commit 7a94d94

Browse files
committed
review comments
1 parent aad980a commit 7a94d94

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,19 @@ bool AMDGPUAtomicOptimizerImpl::run(Function &F) {
178178
return Changed;
179179
}
180180

181-
static bool shouldOptimizeForType(Type *Ty) {
181+
static bool isOptimizableAtomic(Type *Ty) {
182182
switch (Ty->getTypeID()) {
183183
case Type::FloatTyID:
184184
case Type::DoubleTyID:
185185
return true;
186186
case Type::IntegerTyID: {
187-
if (Ty->getIntegerBitWidth() == 32 || Ty->getIntegerBitWidth() == 64)
187+
unsigned size = Ty->getIntegerBitWidth();
188+
if (size == 32 || size == 64)
188189
return true;
190+
}
189191
default:
190192
return false;
191193
}
192-
}
193194
}
194195

195196
void AMDGPUAtomicOptimizerImpl::visitAtomicRMWInst(AtomicRMWInst &I) {
@@ -244,7 +245,7 @@ void AMDGPUAtomicOptimizerImpl::visitAtomicRMWInst(AtomicRMWInst &I) {
244245
// value to the atomic calculation. We can only optimize divergent values if
245246
// we have DPP available on our subtarget, and the atomic operation is 32
246247
// bits.
247-
if (ValDivergent && (!ST->hasDPP() || !shouldOptimizeForType(I.getType()))) {
248+
if (ValDivergent && (!ST->hasDPP() || !isOptimizableAtomic(I.getType()))) {
248249
return;
249250
}
250251

@@ -326,7 +327,7 @@ void AMDGPUAtomicOptimizerImpl::visitIntrinsicInst(IntrinsicInst &I) {
326327
// value to the atomic calculation. We can only optimize divergent values if
327328
// we have DPP available on our subtarget, and the atomic operation is 32
328329
// bits.
329-
if (ValDivergent && (!ST->hasDPP() || !shouldOptimizeForType(I.getType()))) {
330+
if (ValDivergent && (!ST->hasDPP() || !isOptimizableAtomic(I.getType()))) {
330331
return;
331332
}
332333

0 commit comments

Comments
 (0)