[llvm] [llvm][ARM]Add widen strings pass (PR #107120)

Nashe Mncube via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 04:52:05 PDT 2024


================
@@ -2029,6 +2031,129 @@ OptimizeFunctions(Module &M,
   return Changed;
 }
 
+static bool IsCharArray(Type *T) {
+  const unsigned int CHAR_BIT_SIZE = 8;
+  return T && T->isArrayTy() && T->getArrayElementType()->isIntegerTy() &&
+         T->getArrayElementType()->getIntegerBitWidth() == CHAR_BIT_SIZE;
+}
+
+static bool
+tryWidenGlobalString(CallInst *CI, GlobalVariable *SourceVar,
+                     function_ref<TargetTransformInfo &(Function &)> GetTTI,
+                     function_ref<TargetLibraryInfo &(Function &)> GetTLI) {
+
+  auto *F = CI->getCalledFunction();
+  auto *Alloca = dyn_cast<AllocaInst>(CI->getArgOperand(0));
+  auto *BytesToCopy = dyn_cast<ConstantInt>(CI->getArgOperand(2));
+  auto *IsVolatile = dyn_cast<ConstantInt>(CI->getArgOperand(3));
+
+  if (!BytesToCopy)
----------------
nasherm wrote:

Done

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


More information about the llvm-commits mailing list