[llvm] [CodeExtractor] Add align metadata to extracted pointers (PR #131131)

Dominik Adamski via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 14 03:36:42 PDT 2025


================
@@ -1604,8 +1604,26 @@ void CodeExtractor::emitFunctionBody(
       Idx[1] = ConstantInt::get(Type::getInt32Ty(header->getContext()), aggIdx);
       GetElementPtrInst *GEP = GetElementPtrInst::Create(
           StructArgTy, AggArg, Idx, "gep_" + inputs[i]->getName(), newFuncRoot);
-      RewriteVal = new LoadInst(StructArgTy->getElementType(aggIdx), GEP,
-                                "loadgep_" + inputs[i]->getName(), newFuncRoot);
+      LoadInst *LoadGEP =
+          new LoadInst(StructArgTy->getElementType(aggIdx), GEP,
+                       "loadgep_" + inputs[i]->getName(), newFuncRoot);
+      PointerType *ItemType =
+          dyn_cast<PointerType>(StructArgTy->getElementType(aggIdx));
+      if (ItemType && !LoadGEP->getMetadata(LLVMContext::MD_align)) {
----------------
DominikAdamski wrote:

Fixed, thanks for pointing out.

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


More information about the llvm-commits mailing list