Skip to content

Commit

Permalink
Respond to comments
Browse files Browse the repository at this point in the history
- Change getNumOperands to arg size
- Move size check above the for loop
  • Loading branch information
hdelan committed Apr 22, 2024
1 parent 695fcfa commit 6d24772
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions llvm/lib/Target/AMDGPU/AMDGPUOclcReflect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ PreservedAnalyses AMDGPUOclcReflectPass::run(Function &F,
!Callee || Callee->getName() != AMDGPU_OCLC_REFLECT)
continue;

assert(Call->getNumOperands() == 2 &&
assert(Call->arg_size() == 1 &&
"Wrong number of operands to __oclc_amdgpu_reflect function");

ToRemove.push_back(Call);
}

if (!ToRemove.size())
return PreservedAnalyses::all();

for (Instruction *I : ToRemove) {
CallInst *Call = dyn_cast<CallInst>(I);
const Value *Str = Call->getArgOperand(0);
Expand All @@ -83,9 +86,6 @@ PreservedAnalyses AMDGPUOclcReflectPass::run(Function &F,
I->eraseFromParent();
}

if (!ToRemove.size())
return PreservedAnalyses::all();

PreservedAnalyses PA;
PA.preserveSet<CFGAnalyses>();
PA.preserve<DominatorTreeAnalysis>();
Expand Down

0 comments on commit 6d24772

Please sign in to comment.