[PATCH] D156680: AMDGPU: Don't store current instruction in AMDGPULibCalls member

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 05:39:47 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp:113-120
+  void replaceCall(Instruction *I, Value *With) {
+    I->replaceAllUsesWith(With);
+    I->eraseFromParent();
+  }
+
+  void replaceCall(FPMathOperator *I, Value *With) {
+    replaceCall(cast<Instruction>(I), With);
----------------
jmmartinez wrote:
> What do you think about making the functions static members ?
> 
> NIT: [ReplaceInstWithInst](https://llvm.org/doxygen/namespacellvm.html#a4689c154d8eac4af62d37059c9898e6d) also takes the name. Maybe we could use that function instead of the two calls?
ReplaceInstWithInst implies caring about the iterator. Currently this is too far removed from the iterator to care


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156680/new/

https://reviews.llvm.org/D156680



More information about the llvm-commits mailing list