[llvm] [SystemZ] Add inlining heuristic for IV update in callee. (PR #113135)

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 08:58:39 PDT 2024


================
@@ -74,6 +74,40 @@ static void countNumMemAccesses(const Value *Ptr, unsigned &NumStores,
     }
 }
 
+static void getNumGEPIndexUses(const Value *V, unsigned &NumGEPIdxUses) {
+  for (const User *U : V->users()) {
+    if (const auto *LI = dyn_cast<LoadInst>(U)) {
+      assert(isa<AllocaInst>(V) && LI->getType()->isIntegerTy() &&
+             "Expected a load only from the alloca, with integer type.");
----------------
uweigand wrote:

The first direct use of the alloca must be a load, right (cannot have sext, zext, or getelementptr on a pointer type).  Maybe this should be pulled out and done by the caller?

Also, should this function just return the number of users as return value?  In fact, the only caller of this function doesn't even care about the *number* of users, just whether there is one ... so maybe just a bool return?

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


More information about the llvm-commits mailing list