[llvm] [AMDGPU] support lib call (PR #74741)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 00:27:04 PST 2024


================
@@ -2133,8 +2134,22 @@ bool SIFoldOperands::tryOptimizeAGPRPhis(MachineBasicBlock &MBB) {
 }
 
 bool SIFoldOperands::runOnMachineFunction(MachineFunction &MF) {
-  if (skipFunction(MF.getFunction()))
+  auto &F = MF.getFunction();
+  if (skipFunction(F))
     return false;
+  // We cannot delete unused library function, but we can make it empty to
----------------
Pierre-vh wrote:

That seems like the wrong place for this kind of logic, SIFoldOperand doesn't delete functions, AFAIK.
I would just add a "CleanupUnusedLibFun` pass for this instead and run it post-ISel. 

Or just add nothing, after all I doubt this is a 1000 instruction function that'll have a meaningful compile time impact. 

https://github.com/llvm/llvm-project/pull/74741


More information about the llvm-commits mailing list