[llvm] [Analysis][ARM] Remove unused getNumBytesToPadGlobalArray (NFC) (PR #230912)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 11 00:39:56 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-arm

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

The last caller of TargetTransformInfo::getNumBytesToPadGlobalArray was
removed on June 30, 2025 in commit
183acdd27985afd332463e3d9fd4a2ca46d85cf1, leaving
TargetTransformInfoImplBase::getNumBytesToPadGlobalArray,
ARMTTIImpl::getNumBytesToPadGlobalArray, and the command-line option
UseWidenGlobalArrays unused as well.

Assisted-by: Antigravity


---
Full diff: https://github.com/llvm/llvm-project/pull/230912.diff


5 Files Affected:

- (modified) llvm/include/llvm/Analysis/TargetTransformInfo.h (-5) 
- (modified) llvm/include/llvm/Analysis/TargetTransformInfoImpl.h (-5) 
- (modified) llvm/lib/Analysis/TargetTransformInfo.cpp (-6) 
- (modified) llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp (-33) 
- (modified) llvm/lib/Target/ARM/ARMTargetTransformInfo.h (-3) 


``````````diff
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index f7b7e310f5a5d..4dfec6f5edf03 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -2158,11 +2158,6 @@ class TargetTransformInfo {
   /// \return The maximum number of function arguments the target supports.
   LLVM_ABI unsigned getMaxNumArgs() const;
 
-  /// \return For an array of given Size, return alignment boundary to
-  /// pad to. Default is no padding.
-  LLVM_ABI unsigned getNumBytesToPadGlobalArray(unsigned Size,
-                                                Type *ArrayType) const;
-
   /// @}
 
   /// Collect kernel launch bounds for \p F into \p LB.
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index 79f7bb72ec250..90e51fd27d8d2 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -1249,11 +1249,6 @@ class LLVM_ABI TargetTransformInfoImplBase {
 
   virtual unsigned getMaxNumArgs() const { return UINT_MAX; }
 
-  virtual unsigned getNumBytesToPadGlobalArray(unsigned Size,
-                                               Type *ArrayType) const {
-    return 0;
-  }
-
   virtual void collectKernelLaunchBounds(
       const Function &F,
       SmallVectorImpl<std::pair<StringRef, int64_t>> &LB) const {}
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index b589787b6e821..607ac44783d73 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -1626,12 +1626,6 @@ bool TargetTransformInfo::isVectorShiftByScalarCheap(Type *Ty) const {
   return TTIImpl->isVectorShiftByScalarCheap(Ty);
 }
 
-unsigned
-TargetTransformInfo::getNumBytesToPadGlobalArray(unsigned Size,
-                                                 Type *ArrayType) const {
-  return TTIImpl->getNumBytesToPadGlobalArray(Size, ArrayType);
-}
-
 void TargetTransformInfo::collectKernelLaunchBounds(
     const Function &F,
     SmallVectorImpl<std::pair<StringRef, int64_t>> &LB) const {
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
index 1599d9d751b22..a27fe1c056ddf 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -56,10 +56,6 @@ static cl::opt<bool>
     AllowWLSLoops("allow-arm-wlsloops", cl::Hidden, cl::init(true),
                   cl::desc("Enable the generation of WLS loops"));
 
-static cl::opt<bool> UseWidenGlobalArrays(
-    "widen-global-strings", cl::Hidden, cl::init(true),
-    cl::desc("Enable the widening of global strings to alignment boundaries"));
-
 extern cl::opt<TailPredication::Mode> EnableTailPredication;
 
 extern cl::opt<bool> EnableMaskedGatherScatters;
@@ -2973,32 +2969,3 @@ bool ARMTTIImpl::isProfitableToSinkOperands(Instruction *I,
   }
   return true;
 }
-
-unsigned ARMTTIImpl::getNumBytesToPadGlobalArray(unsigned Size,
-                                                 Type *ArrayType) const {
-  if (!UseWidenGlobalArrays) {
-    LLVM_DEBUG(dbgs() << "Padding global arrays disabled\n");
-    return false;
-  }
-
-  // Don't modify none integer array types
-  if (!ArrayType || !ArrayType->isArrayTy() ||
-      !ArrayType->getArrayElementType()->isIntegerTy())
-    return 0;
-
-  // We pad to 4 byte boundaries
-  if (Size % 4 == 0)
-    return 0;
-
-  unsigned NumBytesToPad = 4 - (Size % 4);
-  unsigned NewSize = Size + NumBytesToPad;
-
-  // Max number of bytes that memcpy allows for lowering to load/stores before
-  // it uses library function (__aeabi_memcpy).
-  unsigned MaxMemIntrinsicSize = getMaxMemIntrinsicInlineSizeThreshold();
-
-  if (NewSize > MaxMemIntrinsicSize)
-    return 0;
-
-  return NumBytesToPad;
-}
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
index 9c74d1b91a1fe..f2b94c5b3990f 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
@@ -331,9 +331,6 @@ class ARMTTIImpl final : public BasicTTIImplBase<ARMTTIImpl> {
   bool isProfitableToSinkOperands(Instruction *I,
                                   SmallVectorImpl<Use *> &Ops) const override;
 
-  unsigned getNumBytesToPadGlobalArray(unsigned Size,
-                                       Type *ArrayType) const override;
-
   /// @}
 };
 

``````````

</details>


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


More information about the llvm-commits mailing list