[PATCH] D65281: [IR] Fix getPointerAlignment for CallBase
Hideto Ueno via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 27 23:20:06 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367185: [IR] Fix getPointerAlignment for CallBase (authored by uenoku, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D65281?vs=211738&id=212077#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65281/new/
https://reviews.llvm.org/D65281
Files:
llvm/trunk/lib/IR/Value.cpp
Index: llvm/trunk/lib/IR/Value.cpp
===================================================================
--- llvm/trunk/lib/IR/Value.cpp
+++ llvm/trunk/lib/IR/Value.cpp
@@ -723,9 +723,11 @@
if (AllocatedType->isSized())
Align = DL.getPrefTypeAlignment(AllocatedType);
}
- } else if (const auto *Call = dyn_cast<CallBase>(this))
- Align = Call->getAttributes().getRetAlignment();
- else if (const LoadInst *LI = dyn_cast<LoadInst>(this))
+ } else if (const auto *Call = dyn_cast<CallBase>(this)) {
+ Align = Call->getRetAlignment();
+ if (Align == 0 && Call->getCalledFunction())
+ Align = Call->getCalledFunction()->getAttributes().getRetAlignment();
+ } else if (const LoadInst *LI = dyn_cast<LoadInst>(this))
if (MDNode *MD = LI->getMetadata(LLVMContext::MD_align)) {
ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
Align = CI->getLimitedValue();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65281.212077.patch
Type: text/x-patch
Size: 925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190728/1d4b98d6/attachment.bin>
More information about the llvm-commits
mailing list