[llvm] [AMDGPU][llvm-split] Fix division by zero (PR #98888)

Fraser Cormack via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 04:50:45 PDT 2024


================
@@ -256,11 +256,12 @@ calculateFunctionCosts(SplitModuleLogger &SML, GetTTIFn GetTTI, Module &M,
   }
 
   CostType FnCost = (ModuleCost - KernelCost);
+  CostType ModuleCostOr1 = ModuleCost ? ModuleCost : 1;
----------------
frasercrmck wrote:

Ah right, thank you.

To be honest I'm not sure how the pass is supposed to work in general, let alone with empty/declaration-only modules, so I tried to keep the behaviour as close to the current (albeit buggy) behaviour as possible.

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


More information about the llvm-commits mailing list