@@ -220,7 +220,7 @@ char &llvm::AMDGPUPromoteAllocaToVectorID = AMDGPUPromoteAllocaToVector::ID;
220
220
PreservedAnalyses AMDGPUPromoteAllocaPass::run (Function &F,
221
221
FunctionAnalysisManager &AM) {
222
222
auto &LI = AM.getResult <LoopAnalysis>(F);
223
- bool Changed = AMDGPUPromoteAllocaImpl (TM, LI).run (F, /* PromoteToLDS*/ true );
223
+ bool Changed = AMDGPUPromoteAllocaImpl (TM, LI).run (F, /* PromoteToLDS= */ true );
224
224
if (Changed) {
225
225
PreservedAnalyses PA;
226
226
PA.preserveSet <CFGAnalyses>();
@@ -232,7 +232,7 @@ PreservedAnalyses AMDGPUPromoteAllocaPass::run(Function &F,
232
232
PreservedAnalyses
233
233
AMDGPUPromoteAllocaToVectorPass::run (Function &F, FunctionAnalysisManager &AM) {
234
234
auto &LI = AM.getResult <LoopAnalysis>(F);
235
- bool Changed = AMDGPUPromoteAllocaImpl (TM, LI).run (F, /* PromoteToLDS*/ false );
235
+ bool Changed = AMDGPUPromoteAllocaImpl (TM, LI).run (F, /* PromoteToLDS= */ false );
236
236
if (Changed) {
237
237
PreservedAnalyses PA;
238
238
PA.preserveSet <CFGAnalyses>();
@@ -257,7 +257,7 @@ static void collectAllocaUses(AllocaInst &Alloca,
257
257
for (auto &U : Cur->uses ()) {
258
258
Uses.push_back (&U);
259
259
260
- if (isa<GetElementPtrInst>(U.getUser ()) || isa<BitCastInst>(U. getUser ()) )
260
+ if (isa<GetElementPtrInst>(U.getUser ()))
261
261
WorkList.push_back (cast<Instruction>(U.getUser ()));
262
262
}
263
263
}
@@ -267,10 +267,6 @@ void AMDGPUPromoteAllocaImpl::sortAllocasToPromote(
267
267
SmallVectorImpl<AllocaInst *> &Allocas) {
268
268
DenseMap<AllocaInst *, unsigned > Scores;
269
269
270
- LLVM_DEBUG (dbgs () << " Before sorting allocas:\n " ; for (auto *A
271
- : Allocas) dbgs ()
272
- << " " << *A << " \n " ;);
273
-
274
270
for (auto *Alloca : Allocas) {
275
271
LLVM_DEBUG (dbgs () << " Scoring: " << *Alloca << " \n " );
276
272
unsigned &Score = Scores[Alloca];
@@ -279,7 +275,7 @@ void AMDGPUPromoteAllocaImpl::sortAllocasToPromote(
279
275
collectAllocaUses (*Alloca, Uses);
280
276
for (auto *U : Uses) {
281
277
Instruction *Inst = cast<Instruction>(U->getUser ());
282
- if (isa<GetElementPtrInst>(Inst) || isa<BitCastInst>(Inst) )
278
+ if (isa<GetElementPtrInst>(Inst))
283
279
continue ;
284
280
unsigned UserScore =
285
281
1 + (LoopUserWeight * LI.getLoopDepth (Inst->getParent ()));
@@ -293,9 +289,13 @@ void AMDGPUPromoteAllocaImpl::sortAllocasToPromote(
293
289
return Scores.at (A) > Scores.at (B);
294
290
});
295
291
296
- LLVM_DEBUG (dbgs () << " After sorting allocas:\n " ; for (auto *A
297
- : Allocas) dbgs ()
298
- << " " << *A << " \n " ;);
292
+ // clang-format off
293
+ LLVM_DEBUG (
294
+ dbgs () << " Sorted Worklist:\n " ;
295
+ for (auto *A: Allocas)
296
+ dbgs () << " " << *A << " \n " ;
297
+ );
298
+ // clang-format on
299
299
}
300
300
301
301
bool AMDGPUPromoteAllocaImpl::run (Function &F, bool PromoteToLDS) {
0 commit comments