aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2017-03-30 21:48:55 +0000
committerErich Keane <erich.keane@intel.com>2017-03-30 21:48:55 +0000
commit623efd8a75fef823c83ce5dc1a5666c9e667793c (patch)
tree7167a3fb8d6cf9a71c5edc1d1fcad85271944eaa /clang/lib/CodeGen/CGCall.cpp
parent265a7c71d0ace8262babd00a9109a0d2afd00d89 (diff)
downloadllvm-623efd8a75fef823c83ce5dc1a5666c9e667793c.zip
llvm-623efd8a75fef823c83ce5dc1a5666c9e667793c.tar.gz
llvm-623efd8a75fef823c83ce5dc1a5666c9e667793c.tar.bz2
Clang changes for alloc_align attribute
GCC has the alloc_align attribute, which is similar to assume_aligned, except the attribute's parameter is the index of the integer parameter that needs aligning to. Differential Revision: https://reviews.llvm.org/D29599 llvm-svn: 299117
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 55191b2..e11bc94 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -4348,6 +4348,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
llvm::ConstantInt *AlignmentCI = cast<llvm::ConstantInt>(Alignment);
EmitAlignmentAssumption(Ret.getScalarVal(), AlignmentCI->getZExtValue(),
OffsetValue);
+ } else if (const auto *AA = TargetDecl->getAttr<AllocAlignAttr>()) {
+ llvm::Value *ParamVal =
+ CallArgs[AA->getParamIndex() - 1].RV.getScalarVal();
+ EmitAlignmentAssumption(Ret.getScalarVal(), ParamVal);
}
}